I am trying to implement basic command line functionality.
So I need to be able to pass file as argument, read it and pass result further.
But for some reason it doesn't work as expected.
import click
@click.command()
@click.argument('arg', nargs=1, type=click.File('r'))
def touch(arg):
return len(arg.readlines())
def fill():
print touch()
if __name__ == '__main__':
fill()
There is no any output.
But seems touch() is executing since in case if I am adding print statement into touch() I can see some stuff in output.
touch()with no arguments if in you definition there is one required?clickhandles that under the hood