Menu

#153 Add a new option parser routine tailored for functions

open
cmdline (4)
5
2004-03-03
2003-12-17
Ian Chesal
No

Hey, I find the cmdline library particularly useful for
script writing. I usually define a custom
getFunctionsOpts routine that is a slight twist on the
getKnownOptions routine (no support for -?/-h/-help)
for new Tcl projects. The attached cmdline.tcl file
contains the getFunctionOptions procedure -- I would
like to submit this as a feature request for the next
release of tcllib.

Thanks for all the great utils!

-Ian Chesal

Discussion

  • Ian Chesal

    Ian Chesal - 2003-12-17

    Modified cmdline.tcl that includes cmdline::getFunctionOptions

     
  • Andreas Kupries

    Andreas Kupries - 2004-03-03
    • assigned_to: nobody --> andreas_kupries
     
  • Andreas Kupries

    Andreas Kupries - 2004-03-03

    Logged In: YES
    user_id=75003

    I will have a look, but no promises. Why is the removal of
    the -h support so important ? Was it replaced with something
    else ? Or just an error message ?

     
  • Ian Chesal

    Ian Chesal - 2004-03-03

    Logged In: YES
    user_id=82268

    The attached code doesn't do anything if unexpected options
    are encountered. It just shuffles them into the $argv
    variable like it does with non-option arguments. It's much
    easier to use this in proc's than the other parser because
    you don't want procs to print help information if they get
    bad options -- you want the proc to decide what to do,
    usually thats just returning an error message.