Version 5 of cmdline

Updated 2003-06-12 13:30:22

Package cmdline is a part of Tcllib. Documentation can be read online at http://tcllib.sourceforge.net/doc/cmdline.html , and examples of cmdline usage appear in ftpd, htmlparse, and pop3.

Glenn Jackman offers http://groups.google.com/groups?th=89144039acd5554b#link5 and http://groups.google.com/groups?th=84e714d1329a035#link5 as "examples of cmdline in action".

The cmdline package can be used for both programs which accept arguments via the argv list as well as procs which have specific needs for argument processing.


12 Jun 2003: Here is an example of its use (http://groups.google.com/groups?th=89144039acd5554b ):

    package require cmdline

    proc test {args} {
        set options {
            {first.arg  1 "1st arg"}
            {second.arg 2 "2nd arg"}
            {third.arg  3 "3rd arg"}
            {fourth.arg 4 "4th arg"}
        }

        # cmdline::getoptions will throw an error for unknown option
        array set params [::cmdline::getoptions args $options]

        # do other stuff...
        parray params
    }                

    test -fourth last -first one














Category Package, a subset of Tcllib.