version info

This commit is contained in:
Christian Zangl 2024-06-28 21:40:51 +02:00
parent 053a40de38
commit c8ff616cf9
No known key found for this signature in database
GPG Key ID: 6D468AC36E2A4B3D
2 changed files with 13 additions and 0 deletions

View File

@ -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'

View File

@ -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