C-Like 'getopt' Behavior

Package designed to be used with Rscript to write ``#!'' shebang scripts that accept short and long flags/options. Many users will prefer using instead the packages optparse or argparse which add extra features like automatically generated help option and usage, support for default values, positional argument support, etc.


News

getopt 1.20.2

  • Now allows one to pass an empty string to a character option.

getopt 1.20.1

  • Now explicitly imports the na.omit method from the stats package. Thanks Derrick Oswald for bug report.
  • Improved parsing for negative numbers preceded by a space instead of a '=' sign.
    Thanks Roman Zenka for improved regular expression.
  • Slightly more informative error message if storage.mode coercion results in an NA. Thanks Roman Zenka for suggestion.

getopt 1.20.0

  • Type of "numeric" in spec automatically cast to "double".
    Previously users might have had an error passing negative numbers if they accidentally specified "numeric" instead of "double".
  • Project website moved to https://github.com/trevorld/getopt
  • Exports new function sort_list.

getopt 1.19.1

  • If a passed in option matches multiple options in the getopt specification but matches one exactly then getopt now uses that value instead of throwing a "long flag is ambiguous" error.

getopt 1.19.0

  • Exports new function get_Rscript_filename that returns name of calling script, getopt now uses this function value as default for command argument
  • Documentation improved and now highlights differences between getopt and optparse packages for new undecided users

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("getopt")

1.20.2 by Trevor L Davis, a year ago


https://github.com/trevorld/getopt


Report a bug at https://github.com/trevorld/getopt/issues


Browse source code at https://github.com/cran/getopt


Authors: Allen Day. Contributions from Trevor L Davis and Roman Zenka.


Documentation:   PDF Manual  


GPL (>= 2) license


Imports stats

Suggests testthat


Imported by argparse, optparse.

Depended on by HadoopStreaming.


See at CRAN