I am using @click.command
to do some things with my code. However, before that, I tried the code:
import click
import random
@click.command()
@click.option('--total', default=3, help='Number of vegetables to output.')
def veg(total):
""" Basic method will return a random vegetable"""
for number in range(total):
print(random.choice(['Carrot', 'Potato', 'Turnip', 'Parsnip']))
if __name__ == '__main__':
veg()
print('End function')
I do not understand why the program stops immediately when done with the veg()
function. What do I have to do to keep the program running and run print('End function')
?