rdoc.usage
January 06, 2012 07:32:25 Last update: January 06, 2012 07:32:25
rdoc documentation:
put something like this on top of your script:
method to display it
bind it to the '-h' option via optionparser
source
http://blog.toddwerth.com/entries/5
usage(*args) Display usage information from the comment at the top of the file. String arguments identify specific sections of the comment to display. An optional integer first argument specifies the exit status (defaults to 0)
put something like this on top of your script:
# == Synopsis # Blah blah blah. # # == Examples # This command does blah blah blah. # sample command exec # # == Usage # <file> [options] args # # == Options # -h, --help Displays help message # # == Author # YourName # # == Copyright # Copyright (c)
method to display it
def output_usage
RDoc::usage('usage') # gets usage from comments above
end
bind it to the '-h' option via optionparser
opts.on('-h', '--help') { output_help }
source
http://blog.toddwerth.com/entries/5