Re: [javascriptlint-devel] [PATCH] Replacing getopt with optparse.
Status: Beta
Brought to you by:
matthiasmiller
|
From: Jeff B. <its...@gm...> - 2008-03-31 23:12:59
|
In...@Ja... wrote:
> Jeff Balogh wrote:
> > Attached is a patch that replaces getopt with optparse.
> >
> > I like optparse because it's more maintainable, the order of the options doesn't
> > matter, and you get the usage text for free.
> >
>
> (Replying to list.) Looks good. Committed in r180, with a minor tweak to
> the usage for --unittest.
>
> -Matthias Miller
What is the purpose of running the unittests with `sys.argv[:1]`?
if options.unittest:
unittest.main(pyjsl.jsparse, argv=sys.argv[:1])
If you only want to pass the program name, `sys.argv[0]` would be clearer.
However, limiting argv to just the program name means you can't pass any command
line arguments to unittest (it takes --quiet or --verbose).
I think it would be best to not include any argv parameter, unless there's
something I'm missing.
|