Optional Arguments on Tasks

44 views
Skip to first unread message

Christopher Hunter

unread,
Jan 11, 2014, 9:28:05 PM1/11/14
to pa...@googlegroups.com
Forgive me if I've missed something, but I don't think I have.

Is there a way to create cmdopts that are optional? I guess I was hoping paver had a similar interface for this as say argparse. It would almost make more sense if they were by default optional and you specified a cmd option to be required.

Something like this would be usable:

@task
@cmdopts([
    ('port=', 'p', 'port', 'optional')
])
def start(options):
    """Start task for a MISL server process"""
    launch_app(options.port)

Chris

Almad

unread,
Jan 12, 2014, 6:32:09 PM1/12/14
to pa...@googlegroups.com
Hi,

Paver's @cmdopts is basically a wrapper around optparse. Thus, options
are all optional by default and there is no way to mark some as
required.

I'd say internals should be changed to be argparse-based and to extend
the @cmdopts tuples to have more options, argparse-style.

Patches welcome ;)

Lukas

2014/1/12 Christopher Hunter <hunter.ch...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "paver" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to paver+un...@googlegroups.com.
> To post to this group, send email to pa...@googlegroups.com.
> Visit this group at http://groups.google.com/group/paver.
> For more options, visit https://groups.google.com/groups/opt_out.

Christopher Hunter

unread,
Jan 13, 2014, 8:15:07 AM1/13/14
to pa...@googlegroups.com
Ok, does it support the default flag from optparse?  Curious if there is any docs as to how that maps to the tuple.  

Chris
Reply all
Reply to author
Forward
0 new messages