Conan: Py3: Commands with subarguments do and say nothing if no params are entered

Created on 25 Mar 2019  路  7Comments  路  Source: conan-io/conan

Run: conan editable, conan config, conan remote, conan profile, conan workspace...
In general all the commands with sub arguments. They should show the help.

low ux medium feature

Most helpful comment

Hi!
I reproduced this Issue and seems like this is what's happening: https://bugs.python.org/issue9253#msg186387 so setting subparsers.required = True makes it work the same in both Py2 and Py3:

    def editable(self, *args):
        """ Manage editable packages
        """
        parser = argparse.ArgumentParser(description=self.editable.__doc__,
                                         prog="conan editable")
        subparsers = parser.add_subparsers(dest='subcommand', help='sub-command help')
        subparsers.required = True

I hope this helps!

All 7 comments

$conan editable

usage: conan editable [-h] {add,remove,list} ...
conan editable: error: too few arguments
ERROR: Exiting with code: 2

$ conan config

usage: conan config [-h] {rm,set,get,install} ...
conan config: error: too few arguments
ERROR: Exiting with code: 2

They show the help they have with their subcomands, I don't understand very well this issue.

(conan_use) luism@luism-MacBookPro:~/workspace/conan$ conan editable
(conan_use) luism@luism-MacBookPro:~/workspace/conan$ conan workspace
(conan_use) luism@luism-MacBookPro:~/workspace/conan$ 

For info: I am running Windows, both from source and from pip install package works the same.

Ok, the difference is py3. In py2 it is working fine.

Edited title

Hi!
I reproduced this Issue and seems like this is what's happening: https://bugs.python.org/issue9253#msg186387 so setting subparsers.required = True makes it work the same in both Py2 and Py3:

    def editable(self, *args):
        """ Manage editable packages
        """
        parser = argparse.ArgumentParser(description=self.editable.__doc__,
                                         prog="conan editable")
        subparsers = parser.add_subparsers(dest='subcommand', help='sub-command help')
        subparsers.required = True

I hope this helps!

Thanks so much!

Was this page helpful?
0 / 5 - 0 ratings