Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #107831 > unrolled thread
| Started by | Cameron Simpson <cs@zip.com.au> |
|---|---|
| First post | 2016-04-29 05:49 +1000 |
| Last post | 2016-04-29 05:49 +1000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: What should Python apps do when asked to show help? Cameron Simpson <cs@zip.com.au> - 2016-04-29 05:49 +1000
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2016-04-29 05:49 +1000 |
| Subject | Re: What should Python apps do when asked to show help? |
| Message-ID | <mailman.213.1461874569.32212.python-list@python.org> |
On 29Apr2016 03:06, Chris Angelico <rosuav@gmail.com> wrote: >On Fri, Apr 29, 2016 at 2:33 AM, Steven D'Aprano <steve@pearwood.info> wrote: >> I have an application written in Python which accepts -h or --help to show >> help. I can: >> >> (1) print the help text to stdout; >> >> (2) run the help text through a pager; >> >> (3) do something else? >> >> >> Many command line tools simply output help to stdout (or stderr, if they're >> evil), > >I'm not sure stderr is particularly more evil than stdout, but whatever :) I'm sure. If I _ask_ for the help information, it is not an error message. Instead it is desired output. The logic is clear. If I screw up and elicit an error and the usage message (which might be the help text), that is an error message. But -h/--help? That is standard output, even if it is the same usage text. And on this topic, let me preemptively flame commands whose entire usage message is "use -h/--help for usage". More evil. >What you could do is run the help text through a pager only if stdout >is a TTY. That allows it to be grepped conveniently, but also browsed >easily. But I wouldn't worry about that unless you have at least 3-5 >pages of screed - for most programs, just dumping the text to a >standard stream is usually enough. +1 to this. I'm -0 on conditionally offering a pager based on isatty; Marko Rauhamaa has illustrated one downside, and personally I find _unexpectedly_ paged output to be jarring, requiring me to modeshift my brain. So I'm for keeping it simple and just sending it to stdout. Cheers, Cameron Simpson <cs@zip.com.au>
Back to top | Article view | comp.lang.python
csiph-web