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.
- #log_dapp_running_time(dapp, ignore: false) ⇒ Object
- #run(_argv = ARGV) ⇒ Object
- #run_dapp_command(run_method, options: {}, log_running_time: true) ⇒ 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
90 91 92 |
# File 'lib/dapp/cli/command/base.rb', line 90 def (**kwargs) config.merge(**kwargs) end |
#log_dapp_running_time(dapp, ignore: false) ⇒ Object
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/dapp/cli/command/base.rb', line 75 def log_dapp_running_time(dapp, ignore: false) return yield if ignore begin start_time = Time.now yield ensure dapp.log_step("Running time #{(Time.now - start_time).round(2)} seconds") end end |
#run(_argv = ARGV) ⇒ Object
86 87 88 |
# File 'lib/dapp/cli/command/base.rb', line 86 def run(_argv = ARGV) raise end |
#run_dapp_command(run_method, options: {}, log_running_time: true) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/dapp/cli/command/base.rb', line 63 def run_dapp_command(run_method, options: {}, log_running_time: true) dapp = ::Dapp::Dapp.new(options: ) log_dapp_running_time(dapp, ignore: !log_running_time) do if block_given? yield dapp elsif !run_method.nil? dapp.public_send(run_method) end end end |