Last active
May 23, 2019 14:30
-
-
Save gcarrarom/a5522313aca61f4b24a7aa3e8098e157 to your computer and use it in GitHub Desktop.
Adding Arguments and options
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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