Clean up usage information for commands.
This commit is contained in:
parent
ca5d6b34f1
commit
f1b3dfbf18
|
@ -11,9 +11,11 @@ class Pry
|
|||
target = target()
|
||||
|
||||
opts = Slop.parse!(args) do |opt|
|
||||
opt.banner = "Usage: show-doc [OPTIONS] [METH 1] [METH 2] [METH N]\n" \
|
||||
"Show the comments above method METH. Tries instance methods first and then methods by default.\n" \
|
||||
"e.g show-doc hello_method"
|
||||
opt.banner unindent <<-USAGE
|
||||
Usage: show-doc [OPTIONS] [METH 1] [METH 2] [METH N]
|
||||
Show the comments above method METH. Tries instance methods first and then methods by default.
|
||||
e.g show-doc hello_method
|
||||
USAGE
|
||||
|
||||
opt.on :M, "instance-methods", "Operate on instance methods."
|
||||
opt.on :m, :methods, "Operate on methods."
|
||||
|
@ -56,9 +58,11 @@ class Pry
|
|||
target = target()
|
||||
|
||||
opts = Slop.parse!(args) do |opt|
|
||||
opt.banner "Usage: stat [OPTIONS] [METH]\n" \
|
||||
"Show method information for method METH and set _file_ and _dir_ locals." \
|
||||
"e.g: stat hello_method"
|
||||
opt.banner unindent <<-USAGE
|
||||
Usage: stat [OPTIONS] [METH]
|
||||
Show method information for method METH and set _file_ and _dir_ locals.
|
||||
e.g: stat hello_method
|
||||
USAGE
|
||||
|
||||
opt.on :M, "instance-methods", "Operate on instance methods."
|
||||
opt.on :m, :methods, "Operate on methods."
|
||||
|
@ -100,11 +104,13 @@ class Pry
|
|||
target = target()
|
||||
|
||||
opts = Slop.parse!(args) do |opt|
|
||||
opt.banner "Usage: gist-method [OPTIONS] [METH]\n" \
|
||||
"Gist the method (doc or source) to github.\n" \
|
||||
"Ensure the `gist` gem is properly working before use. http://github.com/defunkt/gist for instructions.\n" \
|
||||
"e.g: gist -m my_method\n" \
|
||||
"e.g: gist -d my_method\n"
|
||||
opt.banner unindent <<-USAGE
|
||||
Usage: gist-method [OPTIONS] [METH]
|
||||
Gist the method (doc or source) to github.
|
||||
Ensure the `gist` gem is properly working before use. http://github.com/defunkt/gist for instructions.
|
||||
e.g: gist -m my_method
|
||||
e.g: gist -d my_method
|
||||
USAGE
|
||||
|
||||
opt.on :m, :method, "Gist a method's source."
|
||||
opt.on :d, :doc, "Gist a method's documentation."
|
||||
|
|
|
@ -17,14 +17,16 @@ class Pry
|
|||
start_line_number, end_line_number, replacement_line = *args
|
||||
|
||||
opts = Slop.parse!(args.compact) do |opt|
|
||||
opt.banner %{Amend a line of input in multi-line mode. `amend-line N`, where the N in `amend-line N` represents line to replace.
|
||||
opt.banner unindent <<-USAGE
|
||||
Amend a line of input in multi-line mode. `amend-line N`, where the N in `amend-line N` represents line to replace.
|
||||
|
||||
Can also specify a range of lines using `amend-line N..M` syntax. Passing '!' as replacement content deletes the line(s) instead. Aliases: %N
|
||||
e.g amend-line 1 puts 'hello world! # replace line 1'
|
||||
e.g amend-line 1..4 ! # delete lines 1..4
|
||||
e.g amend-line 3 >puts 'goodbye' # insert before line 3
|
||||
e.g amend-line puts 'hello again' # no line number modifies immediately preceding line
|
||||
USAGE
|
||||
|
||||
Can also specify a range of lines using `amend-line N..M` syntax. Passing '!' as replacement content deletes the line(s) instead. Aliases: %N
|
||||
e.g amend-line 1 puts 'hello world! # replace line 1'
|
||||
e.g amend-line 1..4 ! # delete lines 1..4
|
||||
e.g amend-line 3 >puts 'goodbye' # insert before line 3
|
||||
e.g amend-line puts 'hello again' # no line number modifies immediately preceding line
|
||||
}
|
||||
opt.on :h, :help, "This message." do
|
||||
output.puts opt
|
||||
end
|
||||
|
@ -56,7 +58,13 @@ e.g amend-line puts 'hello again' # no line number modifies immediately preced
|
|||
|
||||
command "play", "Play back a string variable or a method or a file as input. Type `play --help` for more information." do |*args|
|
||||
opts = Slop.parse!(args) do |opt|
|
||||
opt.banner "Usage: play [OPTIONS] [--help]\nDefault action (no options) is to play the provided string variable\ne.g `play _in_[20] --lines 1..3`\ne.g `play -m Pry#repl --lines 1..-1`\ne.g `play -f Rakefile --lines 5`"
|
||||
opt.banner unindent <<-USAGE
|
||||
Usage: play [OPTIONS] [--help]
|
||||
Default action (no options) is to play the provided string variable
|
||||
e.g `play _in_[20] --lines 1..3`
|
||||
e.g `play -m Pry#repl --lines 1..-1`
|
||||
e.g `play -f Rakefile --lines 5`
|
||||
USAGE
|
||||
|
||||
opt.on :l, :lines, 'The line (or range of lines) to replay.', true, :as => Range
|
||||
opt.on :m, :method, 'Play a method.', true
|
||||
|
|
|
@ -9,9 +9,11 @@ class Pry
|
|||
target = target()
|
||||
|
||||
opts = Slop.parse!(args) do |opt|
|
||||
opt.banner "Usage: show-method [OPTIONS] [METH 1] [METH 2] [METH N]\n" \
|
||||
"Show the source for method METH. Tries instance methods first and then methods by default.\n" \
|
||||
"e.g: show-method hello_method"
|
||||
opt.banner unindent <<-USAGE
|
||||
Usage: show-method [OPTIONS] [METH 1] [METH 2] [METH N]
|
||||
Show the source for method METH. Tries instance methods first and then methods by default.
|
||||
e.g: show-method hello_method
|
||||
USAGE
|
||||
|
||||
opt.on :l, "line-numbers", "Show line numbers."
|
||||
opt.on :b, "base-one", "Show line numbers but start numbering at 1 (useful for `amend-line` and `play` commands)."
|
||||
|
@ -65,9 +67,11 @@ class Pry
|
|||
target = target()
|
||||
|
||||
opts = Slop.parse!(args) do |opt|
|
||||
opt.banner = "Usage: show-command [OPTIONS] [CMD]\n" \
|
||||
"Show the source for command CMD.\n" \
|
||||
"e.g: show-command show-method"
|
||||
opt.banner unindent <<-USAGE
|
||||
Usage: show-command [OPTIONS] [CMD]
|
||||
Show the source for command CMD.
|
||||
e.g: show-command show-method
|
||||
USAGE
|
||||
|
||||
opt.on :l, "line-numbers", "Show line numbers."
|
||||
opt.on :f, :flood, "Do not use a pager to view text longer than one screen."
|
||||
|
@ -110,10 +114,12 @@ class Pry
|
|||
|
||||
command "edit", "Invoke the default editor on a file. Type `edit --help` for more info" do |*args|
|
||||
opts = Slop.parse!(args) do |opt|
|
||||
opt.banner "Usage: edit [--no-reload|--reload] [--line LINE] [--temp|--ex|FILE[:LINE]]\n" \
|
||||
"Open a text editor. When no FILE is given, edits the pry input buffer.\n" \
|
||||
"Ensure #{text.bold("Pry.config.editor")} is set to your editor of choice.\n" \
|
||||
"e.g: edit sample.rb"
|
||||
opt.banner unindent <<-USAGE
|
||||
Usage: edit [--no-reload|--reload] [--line LINE] [--temp|--ex|FILE[:LINE]]
|
||||
Open a text editor. When no FILE is given, edits the pry input buffer.
|
||||
Ensure #{text.bold("Pry.config.editor")} is set to your editor of choice.
|
||||
e.g: edit sample.rb
|
||||
USAGE
|
||||
|
||||
opt.on :e, :ex, "Open the file that raised the most recent exception (_ex_.file)"
|
||||
opt.on :t, :temp, "Open an empty temporary file"
|
||||
|
@ -194,10 +200,12 @@ class Pry
|
|||
target = target()
|
||||
|
||||
opts = Slop.parse!(args) do |opt|
|
||||
opt.banner "Usage: edit-method [OPTIONS] [METH]\n" \
|
||||
"Edit the method METH in an editor.\n" \
|
||||
"Ensure #{text.bold("Pry.config.editor")} is set to your editor of choice.\n" \
|
||||
"e.g: edit-method hello_method"
|
||||
opt.banner unindent <<-USAGE
|
||||
Usage: edit-method [OPTIONS] [METH]
|
||||
Edit the method METH in an editor.
|
||||
Ensure #{text.bold("Pry.config.editor")} is set to your editor of choice.
|
||||
e.g: edit-method hello_method
|
||||
USAGE
|
||||
|
||||
opt.on :M, "instance-methods", "Operate on instance methods."
|
||||
opt.on :m, :methods, "Operate on methods."
|
||||
|
|
Loading…
Reference in New Issue