mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Simplify --version
This commit is contained in:
parent
ce1dbda5b4
commit
0ca0680165
@ -8,7 +8,6 @@ from .config import Config, ConfigDumpError, ConfigLoadError, ConfigOptionError
|
|||||||
from .logging import log
|
from .logging import log
|
||||||
from .pferd import Pferd, PferdLoadError
|
from .pferd import Pferd, PferdLoadError
|
||||||
from .transformer import RuleParseError
|
from .transformer import RuleParseError
|
||||||
from .version import NAME, VERSION
|
|
||||||
|
|
||||||
|
|
||||||
def load_config_parser(args: argparse.Namespace) -> configparser.ConfigParser:
|
def load_config_parser(args: argparse.Namespace) -> configparser.ConfigParser:
|
||||||
@ -81,10 +80,6 @@ def dump_config(args: argparse.Namespace, config: Config) -> None:
|
|||||||
def main() -> None:
|
def main() -> None:
|
||||||
args = PARSER.parse_args()
|
args = PARSER.parse_args()
|
||||||
|
|
||||||
if args.version:
|
|
||||||
print(f"{NAME} {VERSION}")
|
|
||||||
exit()
|
|
||||||
|
|
||||||
# Configuring logging happens in two stages because CLI args have
|
# Configuring logging happens in two stages because CLI args have
|
||||||
# precedence over config file options and loading the config already
|
# precedence over config file options and loading the config already
|
||||||
# produces some kinds of log messages (usually only explain()-s).
|
# produces some kinds of log messages (usually only explain()-s).
|
||||||
|
@ -3,6 +3,7 @@ import configparser
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from ..output_dir import OnConflict, Redownload
|
from ..output_dir import OnConflict, Redownload
|
||||||
|
from ..version import NAME, VERSION
|
||||||
|
|
||||||
CRAWLER_PARSER = argparse.ArgumentParser(add_help=False)
|
CRAWLER_PARSER = argparse.ArgumentParser(add_help=False)
|
||||||
CRAWLER_PARSER_GROUP = CRAWLER_PARSER.add_argument_group(
|
CRAWLER_PARSER_GROUP = CRAWLER_PARSER.add_argument_group(
|
||||||
@ -70,8 +71,8 @@ PARSER = argparse.ArgumentParser()
|
|||||||
PARSER.set_defaults(command=None)
|
PARSER.set_defaults(command=None)
|
||||||
PARSER.add_argument(
|
PARSER.add_argument(
|
||||||
"--version",
|
"--version",
|
||||||
action="store_true",
|
action="version",
|
||||||
help="print version and exit"
|
version=f"{NAME} {VERSION}",
|
||||||
)
|
)
|
||||||
PARSER.add_argument(
|
PARSER.add_argument(
|
||||||
"--config", "-c",
|
"--config", "-c",
|
||||||
|
Loading…
Reference in New Issue
Block a user