Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparision to Click #44

Open
mzfr opened this issue Aug 9, 2018 · 4 comments
Open

Comparision to Click #44

mzfr opened this issue Aug 9, 2018 · 4 comments

Comments

@mzfr
Copy link

mzfr commented Aug 9, 2018

I came across this wrapper recently and I am willing to know that how this is different the Click. Can you please provide some feature comparison ?

@timcera
Copy link
Contributor

timcera commented Aug 10, 2018

The biggest thing for me is that mando parses the docstring for metadata of the command, including help. With Click you have to repeat the help strings from the docstring.

@mzfr
Copy link
Author

mzfr commented Aug 10, 2018

I think Click also does that see: http://click.pocoo.org/5/documentation/

@timcera
Copy link
Contributor

timcera commented Aug 10, 2018

For Click you have to REPEAT the help you have in the docstring into the decorator...

Click

@click.command()
@click.option('--count', default=1, help='number of greetings')
@click.argument('name')
def hello(count, name):
    """This script prints hello NAME COUNT times.

    Parameters
    ----------
    name: str
        The person's name to print a greeting to.
    count: int
        number of greetings
    """
    for x in range(count):
        click.echo('Hello %s!' % name)

Mando

@mando.command(doctype='numpy')
def hello(name, count=1):
    """This script prints hello NAME COUNT times.

    Parameters
    ----------
    name: str
        The person's name to print a greeting to.
    count: int
        number of greetings
    """
    for x in range(count):
        click.echo('Hello %s!' % name)

You can use Mando, Sphinx, Google, or Numpy styled docstrings. Notice that mando parsed the docstring or the argument call itself to find the arguments, keywords, keyword defaults, arguments and keywords types, and all help strings.

I use mando for many of my projects, if you want examples:
https://github.com/timcera/tstoolbox
https://github.com/timcera/hspfbintoolbox
https://github.com/timcera/wdmtoolbox
https://github.com/timcera/swmmtoolbox
https://github.com/timcera/tsgettoolbox

@mzfr
Copy link
Author

mzfr commented Aug 11, 2018

Okay this looks nice. Can you give any other difference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants