Class: SubCommand
Direct Known Subclasses
Class Method Summary collapse
- .banner(command, namespace = nil, subcommand = false) ⇒ Object
-
.is_thor_reserved_word?(word, type) ⇒ Boolean
Hackery.Take the run method away from Thor so that we can redefine it.
- .subcommand_prefix ⇒ Object
Instance Method Summary collapse
-
#initialize(*args) ⇒ SubCommand
constructor
A new instance of SubCommand.
Constructor Details
#initialize(*args) ⇒ SubCommand
Returns a new instance of SubCommand.
5 6 7 8 9 |
# File 'lib/cnvrg/cli/subcommand.rb', line 5 def initialize(*args) super @cli = Cnvrg::CLI.new @curr_dir = @cli.is_cnvrg_dir end |
Class Method Details
.banner(command, namespace = nil, subcommand = false) ⇒ Object
11 12 13 |
# File 'lib/cnvrg/cli/subcommand.rb', line 11 def self.(command, namespace = nil, subcommand = false) "#{basename} #{command.usage}" end |
.is_thor_reserved_word?(word, type) ⇒ Boolean
Hackery.Take the run method away from Thor so that we can redefine it.
21 22 23 24 |
# File 'lib/cnvrg/cli/subcommand.rb', line 21 def is_thor_reserved_word?(word, type) return false if word == "run" super end |
.subcommand_prefix ⇒ Object
15 16 17 |
# File 'lib/cnvrg/cli/subcommand.rb', line 15 def self.subcommand_prefix self.name.gsub(%r{.*::}, '').gsub(%r{^[A-Z]}) {|match| match[0].downcase}.gsub(%r{[A-Z]}) {|match| "-#{match[0].downcase}"} end |