Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #51947
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <joshua.landau.ws@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; ';-)': 0.03; 'subject:: [': 0.04; 'syntax': 0.04; 'yet.': 0.04; 'output': 0.05; 'preferred.': 0.05; 'subject:group': 0.05; 'script?': 0.16; 'subject:argparse': 0.16; 'subject:options': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'advance.': 0.19; 'subject:] ': 0.20; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'appear': 0.29; 'message-id:@mail.gmail.com': 0.30; 'quite': 0.32; 'up.': 0.33; 'to:name:python-list': 0.33; 'could': 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'impression': 0.36; 'module.': 0.36; 'options:': 0.36; 'thanks': 0.36; 'possible': 0.36; 'should': 0.36; 'too': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:\xc2 10': 0.60; 'august': 0.61; '8bit%:27': 0.74; 'behavior': 0.77; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; bh=mBoHkqdUPJylNv0dcKNTh9A5UqKOzxoDj1C7Zdsvup8=; b=UBdyEB2Q7WOKYS7ou7DwolObBfw0UCYRzBSHgxzvrUZLgshuAuArmdKmyCWglS3jP9 okMTcZg6NgbAz3WSh/8Zk/N23ndcDdyOV6QunEtitwboOTqC6zhbyNBs147+tqfWgNFs CdDQ98Z3hGz4GHZu7rdiOmAWilgDQE9PzZu7BDKUC9y/8Xlu6bqgsaesbd4J1BbXvvuR DZuYErRlMMeYlqknNe1ScLK/wI0IXOe47MpXHXfH3HRxQw5Vla/ITEboITpxcenBWjV8 9lfLADLitYQ4MjqTYlWSStMnF+lCKDaOn0OGoFWYQRK6zO6nUYjzdulMZV+Wtw2UCRjr 7u1g== |
| X-Received | by 10.152.45.65 with SMTP id k1mr7618898lam.78.1375674863497; Sun, 04 Aug 2013 20:54:23 -0700 (PDT) |
| MIME-Version | 1.0 |
| Sender | joshua.landau.ws@gmail.com |
| In-Reply-To | <51ff0881$0$2218$426a74cc@news.free.fr> |
| References | <51fdb81b$0$2423$426a74cc@news.free.fr> <51ff0881$0$2218$426a74cc@news.free.fr> |
| From | Joshua Landau <joshua@landau.ws> |
| Date | Mon, 5 Aug 2013 04:53:43 +0100 |
| X-Google-Sender-Auth | y4aj4nBLV3HfvKp25Zwh4ZFfdEM |
| Subject | Re: [argparse] mutually exclusive group with 2 sets of options |
| To | python-list <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=001a11c1b7ae90b60c04e32b4353 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.198.1375674871.1251.python-list@python.org> (permalink) |
| Lines | 124 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1375674871 news.xs4all.nl 15942 [2001:888:2000:d::a6]:55051 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:51947 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On 5 August 2013 03:05, Francois Lafont <francois.lafont@nospam.invalid>wrote:
> Hello,
>
> Up. ;-)
>
> Le 04/08/2013 04:10, Francois Lafont a écrit :
>
> > Is it possible with argparse to have this syntax for a script?
> >
> > my-script (-a -b VALUE-B | -c -d VALUE-D)
> >
> > I would like to do this with the argparse module.
> >
> > Thanks in advance.
>
> I have found this post:
>
> https://groups.google.com/forum/#!searchin/argparse-users/exclusive/argparse-users/-o6GOwhCjbQ/m-PfL4OxLAIJ
>
> It was in 2011 and at that time, it was impossible to have the syntax
> above. I have the impression that it's impossible now yet. Am I wrong?
>
> If it's impossible yet, I could try a hack. With some checks, I think I
> could have the "(-a -b VALUE-B | -c -d VALUE-D)" behavior but I would like
> this syntax appear in the help output too and I have no idea to do it.
If possible you could try docopt. That should be able to do it quite easily.
You could write literally:
My-Script
Usage:
my-script (-a -b VALUE-B | -c -d VALUE-D)
Options:
-b VALUE-B Description
-d VALUE-D Description
as the grammar, but:
My-Script
Usage:
my-script -a -b VALUE-B
my-script -c -d VALUE-D
Options:
-b VALUE-B Description
-d VALUE-D Description
would be preferred.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-04 04:10 +0200
Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-05 04:05 +0200
Re: [argparse] mutually exclusive group with 2 sets of options Joshua Landau <joshua@landau.ws> - 2013-08-05 04:53 +0100
Re: [argparse] mutually exclusive group with 2 sets of options Miki Tebeka <miki.tebeka@gmail.com> - 2013-08-05 07:11 -0700
RE: [argparse] mutually exclusive group with 2 sets of options "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-08-05 17:11 +0000
Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-06 00:13 +0200
Re: [argparse] mutually exclusive group with 2 sets of options Rafael Durán Castañeda <rafadurancastaneda@gmail.com> - 2013-08-05 22:01 +0200
Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-06 00:34 +0200
Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-07 01:18 +0200
Re: [argparse] mutually exclusive group with 2 sets of options Francois Lafont <francois.lafont@nospam.invalid> - 2013-08-07 01:36 +0200
RE: [argparse] mutually exclusive group with 2 sets of options "Joseph L. Casale" <jcasale@activenetwerx.com> - 2013-08-05 22:15 +0000
csiph-web