mando icon indicating copy to clipboard operation
mando copied to clipboard

Comparision to Click

Open mzfr opened this issue 5 years ago • 4 comments

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 ?

mzfr avatar Aug 09 '18 05:08 mzfr

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.

timcera avatar Aug 10 '18 14:08 timcera

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

mzfr avatar Aug 10 '18 15:08 mzfr

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

timcera avatar Aug 10 '18 16:08 timcera

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

mzfr avatar Aug 11 '18 17:08 mzfr