Add args to show version information.
This commit is contained in:
parent
dfaf578356
commit
1d0649ace5
|
@ -8,6 +8,7 @@ import requests
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import os.path
|
import os.path
|
||||||
|
import sys
|
||||||
import urllib.request as urlr
|
import urllib.request as urlr
|
||||||
|
|
||||||
from importlib.metadata import version
|
from importlib.metadata import version
|
||||||
|
@ -581,9 +582,12 @@ def str2bool(boolstring: str) -> bool:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
ap = argparse.ArgumentParser(description="Bulk blocklist tool",
|
ap = argparse.ArgumentParser(
|
||||||
|
description="Bulk blocklist tool",
|
||||||
|
epilog=f"Part of FediBlockHole v{__version__}",
|
||||||
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
ap.add_argument('-c', '--config', default='/etc/default/fediblockhole.conf.toml', help="Config file")
|
ap.add_argument('-c', '--config', default='/etc/default/fediblockhole.conf.toml', help="Config file")
|
||||||
|
ap.add_argument('-V', '--version', action='store_true', help="Show version and exit.")
|
||||||
|
|
||||||
ap.add_argument('-o', '--outfile', dest="blocklist_savefile", help="Save merged blocklist to a local file.")
|
ap.add_argument('-o', '--outfile', dest="blocklist_savefile", help="Save merged blocklist to a local file.")
|
||||||
ap.add_argument('-S', '--save-intermediate', dest="save_intermediate", action='store_true', help="Save intermediate blocklists we fetch to local files.")
|
ap.add_argument('-S', '--save-intermediate', dest="save_intermediate", action='store_true', help="Save intermediate blocklists we fetch to local files.")
|
||||||
|
@ -605,6 +609,10 @@ def main():
|
||||||
levelname = args.loglevel.upper()
|
levelname = args.loglevel.upper()
|
||||||
log.setLevel(getattr(logging, levelname))
|
log.setLevel(getattr(logging, levelname))
|
||||||
|
|
||||||
|
if args.version:
|
||||||
|
print(f"v{__version__}")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
# Load the configuration file
|
# Load the configuration file
|
||||||
args = augment_args(args)
|
args = augment_args(args)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue