Class: Pry::ClassCommand

Overview

This class implements the bare-minimum functionality that a command should
have, namely a --help switch, and then delegates actual processing to its
subclasses.

Create subclasses using Pry::CommandSet#create_command, and override the
options(opt) method to set up an instance of Slop, and the process
method to actually run the command. If necessary, you can also override
setup which will be called before options, for example to require any
gems your command needs to run, or to set up state.

A method to setup Slop commands so it can parse the subcommands your
command expects. If you need to set up default values, use setup
instead.

Examples:

A minimal example

defsubcommands(cmd)cmd.command:downloaddo|opt|description'Downloads a content from a server'opt.on:verbose,'Use verbose output'rundo|options,arguments|ContentDownloader.download(options,arguments)endendend

Define the invokation block anywhere you want

defsubcommands(cmd)cmd.command:downloaddo|opt|description'Downloads a content from a server'opt.on:verbose,'Use verbose output'endenddefprocess# Perform calculations...
opts.fetch_command(:download).rundo|options,arguments|ContentDownloader.download(options,arguments)end# More calculations...
end