class Pry::ClassCommand

gems your command needs to run, or to set up state.
‘setup` which will be called before `options`, for example to require any
method to actually run the command. If necessary, you can also override
`options(opt)` method to set up an instance of Slop, and the `process`
Create subclasses using {Pry::CommandSet#create_command}, and override the
subclasses.
have, namely a –help switch, and then delegates actual processing to its
This class implements the bare-minimum functionality that a command should
A super-class of Commands with structure.

def call(*args)

Returns:
  • (Object) - The return value of `process` or VOID_VALUE

Parameters:
  • args (Array) -- The arguments passed
def call(*args)
  setup
  self.opts = slop
  self.args = self.opts.parse!(args)
  if opts.present?(:help)
    output.puts slop.help
    void
  else
    process(*correct_arg_arity(method(:process).arity, args))
  end
end

def complete(search)

Returns:
  • (Array) - the words to complete

Parameters:
  • search (String) -- The line typed so far
def complete(search)
  slop.map do |opt|
    [opt.long && "--#{opt.long} " || opt.short && "-#{opt.short}"]
  end.flatten(1).compact + super
end

def doc

def doc
  new.help
end

def help

Return the help generated by Slop for this command.
def help
  slop.help
end

def inherited(klass)

match from a ClassCommand super class.
Ensure that subclasses inherit the options, description and
def inherited(klass)
  klass.match  match
  klass.description  description
  klass.command_options options
end

def options(opt); end

Other tags:
    Note: - Please don't do anything side-effecty in the main part of this
def options(opt); end

def process; raise CommandError, "command '#{command_name}' not implemented" end

end
end
gist_method
else
gist_class
if opts.present?(:class)
def process
@example

repl.
created with `:keep_retval => true`, in which case it is returned to the
The return value of this method is discarded unless the command was

and `args` gives the remaining, unparsed arguments.
The `opts` mehod can be called to get the options that Slop has passed,

The actual body of your command should go here.
def process; raise CommandError, "command '#{command_name}' not implemented" end

def setup; end

end
@action = :method
require 'gist'
def setup
@example

for example requiring gems, or setting default values for options.
This method can be used to set up any context your command needs to run,

A method called just before `options(opt)` as part of `call`.
def setup; end

def slop

or the options that this command accepts.
Return an instance of Slop::Commands that can parse either subcommands
def slop
  Slop.parse do |opt|
    opt.banner(unindent(self.class.banner))
    subcommands(opt)
    options(opt)
    opt.on :h, :help, 'Show this message.'
  end
end

def source

def source
  Pry::WrappedModule(self).source
end

def source_file

def source_file
  Pry::WrappedModule(self).source_file
end

def source_line

def source_line
  Pry::WrappedModule(self).source_line
end

def source_location

def source_location
  Pry::WrappedModule(self).source_location
end

def subcommands(cmd); end

Other tags:
    Example: Define the invokation block anywhere you want -
    Example: A minimal example -
def subcommands(cmd); end