Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#28 Command line parsing

closed-accepted
nobody
None
5
2010-08-27
2010-08-25
No

Added and used two functions to get a command line option (a "flag") and an option with a value in order to reduce repeated code.

In the long run command line parsing should be done central and with `optparse` (or maybe `wx.CmdLineParser`?). This might need some changes in the way plugins get at command line options though, because `optparse` needs to know all possible options before parsing the command line. One possibility would be an option for plugin options. For example::

--plugin-options 'opt1 "opt 1" opt2'

The option's value could be parsed with `shlex` and bound to `sys.argv` after parsing the options for the main program. This way there would be no difference for existing plugins. Although I think that all accepted options should be known at parsing time, that is very early in the application's life cycle. Applications should fail with misspelled options and not ignore them.

Discussion

  • Thanks, is in svn

     
    • status: open --> open-accepted
     
    • status: open-accepted --> closed-accepted