[Mono-devel-list] Some new goodies in Mono.GetOptions

Rafael Teixeira monoman at gmail.com
Fri May 6 16:51:52 EDT 2005


Commited to SVN

2005-05-06:2  Rafael Teixeira  <rafaelteixeirabr at hotmail.com>
        * Adding Samples directory with mcat Sample (changed main
Makefile but didn't add to the SUBDIRS)
        * Mono.GetOptions/Options.cs, Mono.GetOptions/OptionList
                An overrideable DefaultArgumentProcessor was added to
base class Options that just collects them
                to the string[] RemainingArguments property as before.
It is a virtual method, but it can also be
                overriden by another method tagged with the
ArgumentProcessorAttribute in the derived class
                to stay binary compatible with old code.
        * Added Mono.GetOptions/KillOptionAttribute.cs
                This new attribute permit to hide (kill) an inherited
option when overriding the virtual base member.
        * Added Mono/AdditionalInfoAttribute.cs
                This new attribute permit to add some extra text at
the end of the automatically generated help screen
        * Added Mono/ReportBugsToAttribute.cs
                This new attribute adds a "Report bugs to <Url>"
message at the end of the automatically generated help screen


Sample run from sample mcat.exe:
-------
[rafael at fedora Samples]$ mono mcat.exe -A first second third
This is just a simulation of a cat-like program.

The command line options where processed by Mono.GetOptions and resulted as:

  ShowTabs = True
  ShowLineEnds = True
  ShowNonPrinting = True
  NumberNonBlank = False
  NumberAllLines = False
  SqueezeBlankLines = False

  RunningOnWindows = False


Would be copying these files to stdout: first, second, third

Follows help screen
---------------------------------------------

mcat  1.0.0.0 - (c)2005 Rafael Teixeira
Simulated cat-like program

Usage: mcat [options] [FILE]...
Concatenate FILE(s), or standard input, to standard output.
Options:
  -A --show-all          equivalent to -vET
  -b --number-nonblank   number nonblank output lines
  -e                     equivalent to -vE
  -E --show-ends         display $ at end of each line
  -n --number            number all output lines
  -s --squeeze-blank     never more than one single blank line
  -t                     equivalent to -vT
  -T --show-tabs         display TAB characters as ^I
  -u                     (ignored)
  -v --show-nonprinting  use ^ and M- notation, except for LFD and TAB
     --help              display this help and exit
     --version           output version information and exit

With no FILE, or when FILE is -, read standard input.

Please report bugs to <rafaelteixeirabr at hotmail.com>
-------

Compare the help-screen part to what 'cat --help' returns

Enjoy,

-- 
Rafael "Monoman" Teixeira
---------------------------------------
I'm trying to become a "Rosh Gadol" before my own eyes. 
See http://www.joelonsoftware.com/items/2004/12/06.html for enlightment.
It hurts!



More information about the Mono-devel-list mailing list