Class: UdbGen::SubcommandWithCommonOptions
- Inherits:
-
Subcommand
- Object
- Subcommand
- UdbGen::SubcommandWithCommonOptions
show all
- Extended by:
- T::Sig
- Includes:
- TTY::Option
- Defined in:
- lib/udb-gen/common_opts.rb
Instance Attribute Summary
Attributes inherited from Subcommand
#desc, #name
Instance Method Summary
collapse
Constructor Details
Returns a new instance of SubcommandWithCommonOptions.
18
19
20
|
# File 'lib/udb-gen/common_opts.rb', line 18
def initialize(name:, desc:)
super(name:, desc:)
end
|
Instance Method Details
#cfg_arch ⇒ Object
42
43
44
45
|
# File 'lib/udb-gen/common_opts.rb', line 42
def cfg_arch
@cfg_arch ||=
resolver.cfg_arch_for(resolve_cfg_arg(params[:cfg]))
end
|
#resolve_cfg_arg(arg) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/udb-gen/common_opts.rb', line 52
def resolve_cfg_arg(arg)
return Pathname.new(arg) if arg.include?(File::SEPARATOR) ||
arg.end_with?(".yaml", ".yml") ||
File.file?(arg)
arg
end
|
#resolver ⇒ Object
37
38
39
|
# File 'lib/udb-gen/common_opts.rb', line 37
def resolver
@resolver ||= Udb::Resolver.new
end
|
#run(argv) ⇒ Object
61
62
63
|
# File 'lib/udb-gen/common_opts.rb', line 61
def run(argv)
raise "must override #run in #{self.class.name}"
end
|