diff --git a/README.md b/README.md index e2546204e077e1c3eeec630e9c658b1bba1b6d15..0c9496f73fc1a73f481391ba3a3ce60cd4e91f5d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ This repository contains the complete collection of ansible playbooks and roles Install these packages: - terraform - - python-typer + - python-click - python-jmespath - moreutils (for playbooks/tasks/reencrypt-vault-key.yml) diff --git a/misc/get_key.py b/misc/get_key.py index 503cd2b5e87c3f8d6fab2c3e00c24f564e7f55c2..572b2f76a67668e896c38daf5434a59720f758b6 100755 --- a/misc/get_key.py +++ b/misc/get_key.py @@ -7,11 +7,9 @@ from contextlib import contextmanager from enum import Enum from pathlib import Path from typing import List -import typer +import click import yaml -app = typer.Typer() - @contextmanager def chdir(path): @@ -56,14 +54,11 @@ class OutputFormat(str, Enum): def __str__(self): return self.value - -def main( - vault: Path = typer.Argument(...), - keys: List[str] = typer.Argument(...), - format: OutputFormat = typer.Option( - OutputFormat.BARE, show_default=True, help="Output format" - ), -): +@click.command() +@click.argument('vault', type=click.Path(exists=True)) +@click.argument('keys', nargs=-1) +@click.option('--format', default=OutputFormat.BARE, type=click.Choice([e.value for e in OutputFormat]), help='Output format') +def main(vault, keys, format): """ Get a bunch of entries from the vault located at VAULT. @@ -84,4 +79,4 @@ def main( if __name__ == "__main__": - typer.run(main) + main()