Skip to content

Commit

Permalink
Rewrite get_key.py to use click instead of typer
Browse files Browse the repository at this point in the history
Typer doesn't work with Click 8[1].

[1] fastapi/typer#280
  • Loading branch information
klausenbusk committed Jun 2, 2021
1 parent 652185f commit 7754214
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
19 changes: 7 additions & 12 deletions misc/get_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
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):
Expand Down Expand Up @@ -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.
Expand All @@ -84,4 +79,4 @@ def main(


if __name__ == "__main__":
typer.run(main)
main()

0 comments on commit 7754214

Please sign in to comment.