1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Update examples for ClassCommand#subcommands

This commit is contained in:
Kyrylo Silin 2013-01-14 17:19:51 +02:00
parent bebf91f558
commit 61326c0089

View file

@ -602,16 +602,39 @@ class Pry
# end
def setup; end
# A method to setup Slop::Commands so it can parse the subcommands your
# 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.
#
# @example
# @example A minimal example
# def subcommands(cmd)
# cmd.on(:d, :download, "Download a content from a server.") do
# @action = :download
# cmd.command :download do |opt|
# description 'Downloads a content from a server'
#
# opt.on :verbose, 'Use verbose output'
#
# run do |options, arguments|
# ContentDownloader.download(options, arguments)
# end
# end
# end
#
# @example Define the invokation block anywhere you want
# def subcommands(cmd)
# cmd.command :download do |opt|
# description 'Downloads a content from a server'
#
# opt.on :verbose, 'Use verbose output'
# end
# end
#
# def process
# # Perform calculations...
# opts.fetch_command(:download).run do |options, arguments|
# ContentDownloader.download(options, arguments)
# end
# # More calculations...
# end
def subcommands(cmd); end
# A method to setup Slop so it can parse the options your command expects.