[issue29626] Issue with spacing in argparse module while using help

2017-02-27 Thread Falguniben Jhaveri

Falguniben Jhaveri added the comment:

There is an extra spacing here if you look carefully. I have commented
above the code. Similarly it happens for "-o" too but not for other
alphabets.

1427:~/mypy/argdev$ python3 issue29626.py delete -h
usage: cli delete [-h] [-p] userid

Deletes a user in your organization.

positional arguments:
  userid The userid of user.

optional arguments:
  -h, --help show this help message and exit
// extra space after p and ",".
  -p , --projectid   Specify the project ID of project from where you want
to
 delete the user or else user will be deleted from
 organization.

I saw this issue as I use argparse for my CLI usecase which has nested
commands.

On Mon, Feb 27, 2017 at 2:39 PM, paul j3 <rep...@bugs.python.org> wrote:

>
> paul j3 added the comment:
>
> This help looks normal:
>
> 1427:~/mypy/argdev$ python3 issue29626.py delete -h
> usage: cli delete [-h] [-p] userid
>
> Deletes a user in your organization.
>
> positional arguments:
>   userid The userid of user.
>
> optional arguments:
>   -h, --help show this help message and exit
>   -p , --projectid   Specify the project ID of project from where you want
> to
>  delete the user or else user will be deleted from
>  organization.
>
> So does this help for the nested subparser:
>
> 1430:~/mypy/argdev$ python3 issue29626.py nodes list -h
> usage: cli nodes list [-h] [-p] [-o]
>
> Lists nodes in your current project
>
> optional arguments:
>   -h, --help   show this help message and exit
>   -p, --projectid
>   -o, --org(For administrators only) Lists all the nodes in
>
> This double layered subparsers is not common, and might not even be
> included in the unittest file.  But provided you don't try anything too
> tricky it does work.  I've seen a few questions along this line on
> StackOverflow.
>
> Note that the help line for '-p' in the second case is empty because you
> did not specify any help string (as you did for 'delete').
>
> --
>
> ___
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue29626>
> ___
>

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29626>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29626] Issue with spacing in argparse module while using help

2017-02-27 Thread Falguniben Jhaveri

Falguniben Jhaveri added the comment:

Sample code to repro this:

import argparse

parser = argparse.ArgumentParser(prog='cli')
subparsers = parser.add_subparsers(dest="command")

subparsers_user_delete = subparsers.add_parser("delete", help="Deletes a 
user in your organization.",
description="Deletes a 
user in your organization.")
subparsers_user_delete.add_argument("userid", help="The userid of user.", 
default=None, type=int)
subparsers_user_delete.add_argument("-p", "--projectid", metavar="",
help="Specify the project ID of project 
from where you want to delete"
 " the user or else user will be 
deleted from organization.", type=int,
default=None)

parser_nodes = subparsers.add_parser('nodes')
sp = parser_nodes.add_subparsers()
p1 = sp.add_parser('list', description='Lists nodes in your current 
project')
p1.add_argument('-p', '--projectid', action='store_true')
p1.add_argument('-o', '--org', action='store_true', help=' (For 
administrators only) Lists all the nodes in')
parser.parse_args()

Please run following command:
$issue.py delete -h

--

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29626>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29626] Issue with spacing in argparse module while using help

2017-02-22 Thread Falguniben Jhaveri

New submission from Falguniben Jhaveri:

When I use argparse the optional arguments with character "-p" and "-s" has 
improper spacing while using help/usage command.

Sample out put from argparse module:

usage: cli node list [-h] [-p] [-o]

Lists nodes in your current project.

optional arguments:
  -h, --help show this help message and exit
  // extra space after p
  -p , --projectid  
  -o, --org (For administrators only) Lists all the nodes in

--
components: Library (Lib)
messages: 288389
nosy: falu2010
priority: normal
severity: normal
status: open
title: Issue with spacing in argparse module while using help
versions: Python 2.7

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29626>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com