Class: Rlt::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rlt/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.command_name(klass) ⇒ Object



16
17
18
# File 'lib/rlt/cli.rb', line 16

def self.command_name(klass)
  Utils::StringUtil.underscore(klass.name.split('::').last)
end

.handle_no_command_error(command) ⇒ Object



11
12
13
14
# File 'lib/rlt/cli.rb', line 11

def self.handle_no_command_error(command)
  raise GitNativeCommandError if Utils::GitUtil::NATIVE_COMMANDS.include? command
  super
end

.run(klass, *arguments) ⇒ Object



20
21
22
23
# File 'lib/rlt/cli.rb', line 20

def self.run(klass, *arguments)
  config = Rlt.config('command', command_name(klass))
  klass.send(:run, config, *arguments)
end

Instance Method Details

#closeObject



40
41
42
# File 'lib/rlt/cli.rb', line 40

def close
  CLI.run Rlt::Commands::Close
end

#cmtObject



30
31
32
# File 'lib/rlt/cli.rb', line 30

def cmt
  CLI.run Rlt::Commands::Cmt, options.add_all?
end

#rstObject



45
46
47
# File 'lib/rlt/cli.rb', line 45

def rst
  CLI.run Rlt::Commands::Rst
end

#switch(branch_name) ⇒ Object



35
36
37
# File 'lib/rlt/cli.rb', line 35

def switch(branch_name)
  CLI.run Rlt::Commands::Switch, branch_name
end