I am trying to use click python package to pass a command line argument to a function. The example from official documentation works as explained. But nowhere in the documentati
You have to tell click to print to stdout using click.echo(). Here is a working example using the code in your question (without caring about exit code as others have mentioned):
import click
@click.command()
@click.option('--count', default=3, help='Number of greetings.')
def hello(count):
"""Simple program that greets NAME for a total of COUNT times."""
for x in range(count):
click.echo('Hello')
return click.echo("hello hi")
if __name__ == '__main__':
hello()