Class: SubCommand
- Inherits:
-
Thor
show all
- Defined in:
- lib/cnvrg/cli/subcommand.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*args) ⇒ SubCommand
5
6
7
8
9
10
11
|
# File 'lib/cnvrg/cli/subcommand.rb', line 5
def initialize(*args)
super
@cli = Cnvrg::CLI.new
@curr_dir = @cli.is_cnvrg_dir
@config = YAML.load_file(@curr_dir + "/.cnvrg/config.yml") if @curr_dir
@helpers = Cnvrg::OrgHelpers.new();
end
|
Class Method Details
.banner(command, namespace = nil, subcommand = false) ⇒ Object
13
14
15
|
# File 'lib/cnvrg/cli/subcommand.rb', line 13
def self.banner(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.
23
24
25
26
|
# File 'lib/cnvrg/cli/subcommand.rb', line 23
def is_thor_reserved_word?(word, type)
return false if word == "run"
super
end
|
.subcommand_prefix ⇒ Object
17
18
19
|
# File 'lib/cnvrg/cli/subcommand.rb', line 17
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
|