Skip to content

Instantly share code, notes, and snippets.

@gcarrarom
Last active May 23, 2019 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gcarrarom/a5522313aca61f4b24a7aa3e8098e157 to your computer and use it in GitHub Desktop.
Save gcarrarom/a5522313aca61f4b24a7aa3e8098e157 to your computer and use it in GitHub Desktop.
Adding Arguments and options
#!/usr/bin/env python
import os
import click
from pathlib import Path
@click.command()
@click.argument(
"resource",
type=click.Choice(
[
'users',
'clusters',
'contexts'
]
),
default='contexts'
)
@click.option(
'--kubeconfig', '-k', default=f'{Path.home()}/.kube/config',
help='Path to the config file to clean'
)
@click.option(
'--name', '-n',
help='Name of the entry to remove',
)
def cli(resource, kubeconfig, name):
"""
A little CLI tool to help keeping Config Files clean :)
"""
if __name__ == '__main__':
cli(obj={})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment