Skip to content

Instantly share code, notes, and snippets.

@banister
Created March 17, 2011 10:20
Show Gist options
  • Save banister/874115 to your computer and use it in GitHub Desktop.
Save banister/874115 to your computer and use it in GitHub Desktop.
OptionParser.new do |opts|
opts.banner = %{Usage: show-doc [OPTIONS] [METH]
Show the comments above method METH. Tries instance methods first and then methods by default.
e.g show-doc hello_method
--
}
opts.on("-M", "--instance-methods", "Operate on instance methods.") do
options[:M] = true
end
opts.on("-m", "--methods", "Operate on methods.") do
options[:m] = true
end
opts.on("-c", "--context CONTEXT", "Select object context to run under.") do |context|
target = Pry.binding_for(target.eval(context))
end
opts.on_tail("-h", "--help", "This message.") do
output.puts opts
options[:h] = true
end
end.order(args) do |v|
meth_name = v
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment