diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-10-10 21:03:15 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-10-10 21:03:15 +0200 |
commit | 46fe6f404cfa090f7afab00de7037f1231388250 (patch) | |
tree | c6f08b0a10e9bd5baa075889f273eacddc4b68b7 | |
parent | e1361e556840a1a710385cd1a09bfa1a9f91742a (diff) | |
download | fietsboek-46fe6f404cfa090f7afab00de7037f1231388250.tar.gz fietsboek-46fe6f404cfa090f7afab00de7037f1231388250.tar.bz2 fietsboek-46fe6f404cfa090f7afab00de7037f1231388250.zip |
fietsupdater: add a "status" subcommand
-rw-r--r-- | fietsboek/updater/cli.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fietsboek/updater/cli.py b/fietsboek/updater/cli.py index 2a7fc14..f00dfde 100644 --- a/fietsboek/updater/cli.py +++ b/fietsboek/updater/cli.py @@ -159,6 +159,29 @@ def revision(config, revision_id): click.echo(f"Revision saved to {filename}") +@cli.command("status") +@config_option +def status(config): + """Display information about the current version and available updates.""" + updater = Updater(config) + updater.load() + current = updater.current_versions() + heads = updater.heads() + click.secho("Current versions:", fg="yellow") + if current: + for i in current: + click.echo(i) + else: + click.secho("No current version", fg="red") + click.secho("Available updates:", fg="yellow") + updates = set(heads) - set(current) + if updates: + for i in updates: + click.echo(i) + else: + click.secho("All updates applied!", fg="green") + + @cli.command("help", hidden=True) @click.pass_context @click.argument("subcommand", required=False) |