Class: Dapp::CLI::Command::Base
- Defined in:
- lib/dapp/cli/command/base.rb
Direct Known Subclasses
Deployment::CLI::Command::Base, Dimg::CLI::Command::Base, Kube::CLI::Command::Base
Constant Summary
Constants inherited from Dapp::CLI
Instance Method Summary collapse
- #cli_options(**kwargs) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #run(_argv = ARGV) ⇒ Object
- #run_dapp_command(run_method, *args) ⇒ Object
- #run_method ⇒ Object
Methods included from Helper::Cli
#cli_wrapper, #composite_options, #in_validate!, #list_msg_format, #parse_options, #parse_subcommand, #prepare_subcommand, #required_argument, #run_subcommand
Methods included from Helper::Trivia
class_to_lowercase, #class_to_lowercase, #delete_file, #kwargs, #make_path, #search_file_upward
Constructor Details
Instance Method Details
#cli_options(**kwargs) ⇒ Object
81 82 83 |
# File 'lib/dapp/cli/command/base.rb', line 81 def (**kwargs) config.merge(dapp_command: run_method, **kwargs) end |
#run(_argv = ARGV) ⇒ Object
77 78 79 |
# File 'lib/dapp/cli/command/base.rb', line 77 def run(_argv = ARGV) raise end |
#run_dapp_command(run_method, *args) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/dapp/cli/command/base.rb', line 59 def run_dapp_command(run_method, *args) dapp = ::Dapp::Dapp.new(*args) ::Dapp::CLI.dapp_object = dapp dapp.("Manual usage: `#{self.run_method}` command") unless ENV['CI'] begin if block_given? yield dapp elsif !run_method.nil? dapp.public_send(run_method) end end end |
#run_method ⇒ Object
73 74 75 |
# File 'lib/dapp/cli/command/base.rb', line 73 def run_method class_to_lowercase end |