Hi, I spend last few days investigating a workarounds to solve that '-' problem :) It seems it is possible.
BTW, I checked the possibility of uploading the final product to Pip where anyone can install Stratos CLI using Pip like $Pip install stratos and then run like $ stratos -u abcdef What's your idea on that? ( We can also provide python script with a wrapper for Windows and Linux ) On Fri, Feb 27, 2015 at 9:45 PM, Milindu Sanoj Kumarage < agentmili...@gmail.com> wrote: > Hi, > > the reason is Cmd2 ( and most of the python CLI frameworks ) uses > function mapping to CLI commands, that is, > > // stratos>greet > def do_greet(): > print("hi") > > will become the 'greet' command. > > But if we need, > > 'list-tenants' we have to code it as > > def do_list-tenants: > #codes of list tenant command > > But using '-' in names of functions ( def*enitions* ) in Python is not > allowed. > What shall we do? I'm okay even to write it from the scratch. > > > > On Fri, Feb 27, 2015 at 9:29 PM, Imesh Gunaratne <im...@apache.org> wrote: > >> Hi Milindu, >> >> Is there any way of using "-" in the CLI commands. I did not get why a >> CLI framework would block "-" character. >> >> Thanks >> >> On Fri, Feb 27, 2015 at 2:49 PM, Milindu Sanoj Kumarage < >> agentmili...@gmail.com> wrote: >> >>> Hi, >>> >>> Then shall we go with Cmd2 python package? Only change we have to do is >>> call CLI commands with '_ ' instead '-', like 'list_tenants' instead of >>> 'list-tenants'. >>> >>> And for HTTP request/response handling, we can use either Python's >>> urllib3 or Requests, a wrapper around urllib3 which gives much simpler API >>> that leads to cleaner codes. It's been praised in the community from the >>> beginning. >>> >>> Licence: Apache2 >>> >>> http://docs.python-requests.org/en/latest/# >>> >>> On Wed, Feb 25, 2015 at 3:26 PM, Milindu Sanoj Kumarage < >>> agentmili...@gmail.com> wrote: >>> >>>> Hi, >>>> >>>> Here I have included the licences of each framework :) >>>> >>>> *Cement *(6/10) >>>> A complex framework, every CLI commands is bound to a separate Python >>>> class that acts like an controller, and each controller have several >>>> functions. But no 'Interactive Mode' support, just 'Single command line >>>> mode'. Supports having '-' in CLI Commands ( like 'create-tenant' ) >>>> via aliases. But no much developments in Github repo recently. >>>> >>>> http://cement.readthedocs.org/ >>>> >>>> Licence : http://cement.readthedocs.org/en/latest/license/ >>>> Redistribution and use in source and binary forms, with or without >>>> modification, are permitted under given conditions. >>>> >>>> >>>> *Click *(7/10) >>>> Rich with features, uses Python Decorators to bind CLI commands to >>>> functions. But no 'Interactive Mode' support, just 'Single command line >>>> mode'. >>>> >>>> http://click.pocoo.org/3/ >>>> >>>> Licence : http://click.pocoo.org/3/license/ >>>> three-clause BSD License >>>> >>>> >>>> *Plac *(4/10) >>>> A scaled down version of Python argparse package. Uses set of if else >>>> statements to process the commands. But no 'Interactive Mode' support. >>>> >>>> http://plac.googlecode.com/hg/doc/plac.html >>>> >>>> Licence: http://plac.googlecode.com/hg/doc/plac.html >>>> BSD license >>>> >>>> *Cliapp *(3/10) >>>> No 'Interactive Mode' support. >>>> >>>> http://code.liw.fi/cliapp/docs/ >>>> >>>> Licence : https://github.com/rshk/CliApp/blob/master/LICENSE >>>> Apache License >>>> >>>> >>>> *pyCLI *(3/10) >>>> No 'Interactive Mode' support. >>>> >>>> http://pythonhosted.org//pyCLI/ >>>> >>>> Licence: http://sourceforge.net/projects/pycli/ >>>> GNU General Public License version 2.0 (GPLv2) >>>> >>>> >>>> *Cliff *(9/10) >>>> A framework for building command line programs by OpenStack. It uses >>>> plugins to define sub-commands, output formatters, and other extensions. >>>> Supports 'Interactive Mode' using 'cmd2' and 'cmd' >>>> >>>> http://docs.openstack.org/developer/cliff/index.html >>>> >>>> Licence: https://launchpad.net/python-cliff >>>> Apache Licence >>>> >>>> >>>> *cmd *(8/10) >>>> Python in built packages for 'Interactive Mode' applications. Maps CLI >>>> commands to functions by function name, as def do_<whatever the >>>> command name> ( eg: def do_command1 is for command1 ). Support only >>>> arguments but no support for Unix-style flags. Have features like automatic >>>> command completion in 'Interactive Mode'. >>>> >>>> https://docs.python.org/2/library/cmd.html >>>> >>>> Licence: https://docs.python.org/2/license.html >>>> GPL compatible >>>> >>>> >>>> *cmd2 *(9/10) >>>> Extends the Python Standard Library’s cmd package. Can handle >>>> arguments and flags. Supports for Output Redirection and Piping ( As in a >>>> Unix shell ). Searchable command history ( bash-like history list editing >>>> ), can get last commands with arrow keys. Able to perform shell commands >>>> while in Interactive mode. ( eg: stratos>!ls or stratos>shell ls ) output >>>> can be colored. >>>> >>>> https://pythonhosted.org/cmd2 >>>> >>>> Licence: https://pypi.python.org/pypi/cmd2/0.6.8 >>>> MIT License >>>> >>>> On Wed, Feb 25, 2015 at 10:29 AM, Chamila De Alwis <chami...@wso2.com> >>>> wrote: >>>> >>>>> Great work Milindu. It would be better to add the licenses for each >>>>> library too, in case any non-compatible or ambiguous ones might be there. >>>>> >>>>> IMO using a framework from the standard library would be better, since >>>>> the pre-requisites will be minimal. >>>>> On Feb 25, 2015 9:55 AM, "Milindu Sanoj Kumarage" < >>>>> agentmili...@gmail.com> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> Here is the JIRA issue on this, >>>>>> https://issues.apache.org/jira/browse/STRATOS-1187 >>>>>> >>>>>> >>>>>> Here I have added some of the Python CLI frameworks I checked, I have >>>>>> added a brief for each of them. I also have state a score out of 10 to >>>>>> indicate how best they matches for our need. ( But they are as of my >>>>>> understanding! I may not be very correct in some cases. Because some of >>>>>> the ones I could write some codes and check, but for some I could not, >>>>>> manly because of errors ) >>>>>> >>>>>> *Cement *(6/10) >>>>>> A complex framework, every CLI commands is bound to a separate Python >>>>>> class that acts like an controller, and each controller have several >>>>>> functions. But no 'Interactive Mode' support, just 'Single command line >>>>>> mode'. Supports having '-' in CLI Commands ( like 'create-tenant' ) >>>>>> via aliases. But no much developments in Github repo recently. >>>>>> >>>>>> http://cement.readthedocs.org/ >>>>>> >>>>>> *Click *(7/10) >>>>>> Rich with features, uses Python Decorators to bind CLI commands to >>>>>> functions. But no 'Interactive Mode' support, just 'Single command line >>>>>> mode'. >>>>>> >>>>>> http://click.pocoo.org/3/ >>>>>> >>>>>> >>>>>> *Plac *(4/10) >>>>>> A scaled down version of Python argparse package. Uses set of if >>>>>> else statements to process the commands. But no 'Interactive Mode' >>>>>> support. >>>>>> >>>>>> http://plac.googlecode.com/hg/doc/plac.html >>>>>> >>>>>> *Cliapp *(3/10) >>>>>> No 'Interactive Mode' support. >>>>>> >>>>>> http://code.liw.fi/cliapp/docs/ >>>>>> >>>>>> *pyCLI *(3/10) >>>>>> No 'Interactive Mode' support. >>>>>> >>>>>> http://pythonhosted.org//pyCLI/ >>>>>> >>>>>> >>>>>> *Cliff *(9/10) >>>>>> A framework for building command line programs by OpenStack. It uses >>>>>> plugins to define sub-commands, output formatters, and other extensions. >>>>>> Supports 'Interactive Mode' using 'cmd2' and 'cmd' >>>>>> >>>>>> http://docs.openstack.org/developer/cliff/index.html >>>>>> >>>>>> *cmd *(8/10) >>>>>> Python in built packages for 'Interactive Mode' applications. Maps >>>>>> CLI commands to functions by function name, as def do_<whatever the >>>>>> command name> ( eg: def do_command1 is for command1 ). Support only >>>>>> arguments but no support for Unix-style flags. Have features like >>>>>> automatic >>>>>> command completion in 'Interactive Mode'. >>>>>> >>>>>> https://docs.python.org/2/library/cmd.html >>>>>> >>>>>> *cmd2 *(9/10) >>>>>> Extends the Python Standard Library’s cmd package. Can handle >>>>>> arguments and flags. Supports for Output Redirection and Piping ( As in >>>>>> a >>>>>> Unix shell ). Searchable command history ( bash-like history list >>>>>> editing >>>>>> ), can get last commands with arrow keys. Able to perform shell commands >>>>>> while in Interactive mode. ( eg: stratos>!ls or stratos>shell ls ) >>>>>> output >>>>>> can be colored. >>>>>> >>>>>> https://pythonhosted.org/cmd2 >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>> >>> >> >> >> -- >> Imesh Gunaratne >> >> Technical Lead, WSO2 >> Committer & PMC Member, Apache Stratos >> > >