module CommandKit::Main::ClassMethods

Class-level methods.

Public Instance Methods

main(argv=[], **kwargs) click to toggle source

Initializes the command class with the given keyword arguments, then calls {Main#main main} with the given `argv`.

@param [Array<String>] argv

The Array of command-line arguments.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments to initialize the command class with.

@return [Integer]

The exit status of the command.

@api public

# File lib/command_kit/main.rb, line 76
def main(argv=[], **kwargs)
  new(**kwargs).main(argv)
end
start(argv=ARGV, **kwargs) click to toggle source

Starts the command and then exits.

@param [Array<String>] argv

The Array of command-line arguments.

@api public

# File lib/command_kit/main.rb, line 51
def start(argv=ARGV, **kwargs)
  exit main(argv, **kwargs)
rescue Interrupt
  # https://tldp.org/LDP/abs/html/exitcodes.html
  exit 130
rescue Errno::EPIPE
  # STDOUT pipe broken
  exit 0
end