I have a command like :
$trial login --user
For this I used python-click
to wrap my python functions and is working fine. I am very new to python-click
and having having to construct a command in a certain way than what is mentioned above.
Below is my present code of a file trial.py
,
@click.command()
@click.option('--user', prompt='Username', help='Username.')
@click.option('--password', prompt='Password', help='Password.')
def login(user, password):
"""Simple program that greets NAME for a total of COUNT times."""
login_cli(user,password)
print "done"
@click.group()
def cli():
pass
And my setup.py
file looks like the following:
from setuptools import setup
setup(
name='trial',
version='0.1',
py_modules=['trial'],
install_requires=[
'Click',
],
entry_points='''
[console_scripts]
trial=trial:cli
''',
)
But now I want to change the command a little. I want to make it something like,
$trial k8s login --user
I want to add a series of k8s commands but don't know how to include it in the code and would want some guidance on the same.