[FRPythoneers] dispatching from a script

Brent Pedersen bpederse at gmail.com
Fri Apr 15 11:44:32 MDT 2011


On Fri, Apr 15, 2011 at 11:37 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Fri, Apr 15, 2011 at 11:29 AM, Brent Pedersen <bpederse at gmail.com> wrote:
>> hi, not sure if this list is the appropriate venue, but i'll ask anyway.
>
> Nothing wrong with asking here, but comp.lang.python would probably be
> better by virtue of having more users.
>

yeah, but i dont want to subscribe to (yet another) high-volume mailing list

>
>> so i have a python library and i want to have several scripts but keep
>> them in the same name space.
>> so i'll have "mymodule" that's importable from python and then i want
>> to be able to have console scripts
>> like:
>>
>> $ mymodule action_a --args files
>> $ mymodule actoin_b --other_args other_files
>> etc.
>
> The argparse module in the standard library has support for
> sub-commands and probably does exactly what you want.
>
> Cheers,
> Ian
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
>

thanks, that does what i want:
http://docs.python.org/dev/library/argparse.html#sub-commands
just looks like it's not even in the 2.7 stdlib, so i'll add it as a dependency.
-b



More information about the FRPythoneers mailing list