From c8ff616cf96b078bfb82e6dadea920b55134937e Mon Sep 17 00:00:00 2001 From: Christian Zangl Date: Fri, 28 Jun 2024 21:40:51 +0200 Subject: [PATCH] version info --- .github/workflows/build.yml | 3 +++ chkbit_cli/main.py | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 00a82f6..02dfd2a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,10 +36,13 @@ jobs: cat build/chkbit/warn-chkbit.txt cd dist; ls -l if [ "$RUNNER_OS" == "Linux" ]; then + ./chkbit --version tar -czf chkbit-linux_amd64.tar.gz chkbit elif [ "$RUNNER_OS" == "macOS" ]; then + ./chkbit --version tar -czf chkbit-macos_amd64.tar.gz chkbit elif [ "$RUNNER_OS" == "Windows" ]; then + chkbit.exe --version 7z a -tzip chkbit-windows_amd64.zip chkbit.exe else echo 'unknown runner' diff --git a/chkbit_cli/main.py b/chkbit_cli/main.py index 61bcbb3..21d0e59 100644 --- a/chkbit_cli/main.py +++ b/chkbit_cli/main.py @@ -10,6 +10,8 @@ from datetime import datetime, timedelta from chkbit import Context, Status, IndexThread from . import CLI, Progress, RateCalc, sparkify +import importlib.metadata + EPILOG = """ .chkbitignore rules: @@ -339,8 +341,16 @@ class Main: "-v", "--verbose", action="store_true", help="verbose output" ) + parser.add_argument( + "-V", "--version", action="store_true", help="show version information" + ) + args = parser.parse_args() + if args.version: + print(importlib.metadata.version("chkbit")) + return + self.verbose = args.verbose or args.show_ignored_only if args.log_file: self.log_verbose = args.log_verbose