Class: Dapp::Dimg::CLI::Command::Base

Inherits:
CLI::Command::Base show all
Defined in:
lib/dapp/dimg/cli/command/base.rb

Constant Summary

Constants inherited from CLI

CLI::SUBCOMMANDS

Instance Method Summary collapse

Methods inherited from CLI::Command::Base

#cli_options, #initialize, #run_method

Methods inherited from CLI

#initialize

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

This class inherits a constructor from Dapp::CLI::Command::Base

Instance Method Details

#run(argv = ARGV) ⇒ Object



4
5
6
7
# File 'lib/dapp/dimg/cli/command/base.rb', line 4

def run(argv = ARGV)
  self.class.parse_options(self, argv)
  run_dapp_command(run_method, options: cli_options(dimgs_patterns: cli_arguments))
end

#run_dapp_command(run_method, *args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dapp/dimg/cli/command/base.rb', line 9

def run_dapp_command(run_method, *args)
  super(nil, *args) do |dapp|
    begin
      dapp.
      if block_given?
        yield dapp
      elsif !run_method.nil?
        dapp.public_send(run_method)
      end
    ensure
      dapp.terminate
    end
  end
end