[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-10-25 Thread paul j3


paul j3  added the comment:

Are you expecting the subcommand help to show the 'help' line that the main 
help shows?

subparsers.add_parser('a', help='a help')

add_parser takes all of the parameters that `ArgumentParser` takes, including 
description and epilog.  

I don't think we need to add anything to add_parser.

--
nosy: +paul.j3

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-10-24 Thread Hai Shi


Hai Shi  added the comment:

Hi, Chuanlong. Would you mind to upload a demo for this question?

--
nosy: +shihai1991

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-10-23 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

For me it works as well, tested on 3.7, 3.9 and 3.11 .

--
nosy: +andrei.avk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-09-25 Thread Nikita Sobolev


Nikita Sobolev  added the comment:

Hi!

>From your description it is not clear how exactly you create your subcommand.

>From my experience, it works. Demo:

```
import argparse

parser = argparse.ArgumentParser(description='Process some integers.')
subparsers = parser.add_subparsers()

# create the parser for the "a" command
parser_a = subparsers.add_parser('a', help='a help', description='test me')
parser_a.add_argument('bar', type=int, help='bar help')

print(parser.parse_args())
```

Here's the output of `python script.py a -h`:

```
usage: ex.py a [-h] bar

test me

positional arguments:
  bar bar help

options:
  -h, --help  show this help message and exit
```

Do you have the same setup? Or is there anything else that needs to be fixed?

--
nosy: +sobolevn

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-09-24 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions:  -Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45275] Make argparse print description of subcommand when invoke help doc on subcommand

2021-09-23 Thread Chuanlong Du


New submission from Chuanlong Du :

I have command-line script `blog` written using argparse. It supports 
subcommands. When I check the help doc of a subcommand, e.g., using `blog 
convert -h`, it prints the help doc of the subcommand `blog convert` but 
doesn't print the description of the subcommand `blog convert`. A screenshot is 
attached. It is quite often that I know a command-line application have certain 
subcommands but I forget exactly what they do. It would be very helpful if 
`blog subcmd -h` prints the description of the subcmd so that users do not have 
to call `blog -h` again to check exactly what the subcommand does.

--
components: Library (Lib)
files: Selection_011.png
messages: 402541
nosy: longendu
priority: normal
severity: normal
status: open
title: Make argparse print description of subcommand when invoke help doc on 
subcommand
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 
3.9
Added file: https://bugs.python.org/file50301/Selection_011.png

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com