Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34294

How does one make argparse print usage when no options are provided on the command line?

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'args': 0.04; 'exception.': 0.07; 'subject:How': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:command': 0.09; 'argparse': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'statement.': 0.16; 'subject: \n ': 0.16; 'subject:argparse': 0.16; 'subject:options': 0.16; 'subject:usage': 0.16; 'subject:when': 0.16; 'examples': 0.18; 'command': 0.24; 'header :User-Agent:1': 0.26; 'separate': 0.27; 'options': 0.27; 'header:X -Complaints-To:1': 0.28; 'print': 0.32; 'to:addr:python-list': 0.33; 'subject:?': 0.35; 'received:org': 0.36; 'but': 0.36; 'wanted': 0.36; "didn't": 0.36; 'charset:us-ascii': 0.36; 'instead': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'received:sd.cox.net': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From rh <richard_hubbe11@lavabit.com>
Subject How does one make argparse print usage when no options are provided on the command line?
Date Wed, 5 Dec 2012 08:48:30 -0800
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host ip184-187-163-27.sb.sd.cox.net
User-Agent dsodnetnin
X-Mailer EZnn0.37p
X-Newsreader EZnn0.37p
X-Gmane-NNTP-Posting-Host EZnn0.37p
Original-Received from slem by 1.1 with local
X-No-Archive yes
Archive no
X-Archive expiry=11
X-Archive encrypt
X-Operating-System Barebones_6.1
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.501.1354726122.29569.python-list@python.org> (permalink)
Lines 6
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1354726122 news.xs4all.nl 6877 [2001:888:2000:d::a6]:45373
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:34294

Show key headers only | View raw


I have argparse working with one exception. I wanted the program to print out
usage when no command line options are given. But I only came across
other examples where people didn't use argparse but instead printed out
a separate usage statement. So they used argparse for everything but the
case where no command line args are given.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

How does one make argparse print usage when no options are provided on the command line? rh <richard_hubbe11@lavabit.com> - 2012-12-05 08:48 -0800

csiph-web