shell
pip install pycli
python
import pycli
python
import pycli
@pycli.command('greet')
def greet_user(args):
print(f"Hello, {args.name}!")
if __name__ == '__main__':
pycli.run()
shell
python your_script.py greet --name John
python
import pycli
@pycli.command('greet')
def greet_user(args):
print(f"Hello, {args.name}!")
@pycli.command('farewell')
def say_goodbye(args):
print(f"Goodbye, {args.name}!")
if __name__ == '__main__':
pycli.run()
python
import pycli
@pycli.command('greet')
def greet_user(args):
name = args.name
if args.upper:
name = name.upper()
print(f"Hello, {name}!")
if __name__ == '__main__':
pycli.run()
shell
python your_script.py greet --name John --upper