mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Implement --version flag
This commit is contained in:
parent
5916626399
commit
92886fb8d8
@ -6,8 +6,14 @@ from pathlib import Path
|
||||
from .config import Config, ConfigDumpException, ConfigLoadException
|
||||
from .output_dir import OnConflict, Redownload
|
||||
from .pferd import Pferd
|
||||
from .version import NAME, VERSION
|
||||
|
||||
GENERAL_PARSER = argparse.ArgumentParser(add_help=False)
|
||||
GENERAL_PARSER.add_argument(
|
||||
"--version",
|
||||
action="store_true",
|
||||
help="print version and exit"
|
||||
)
|
||||
GENERAL_PARSER.add_argument(
|
||||
"--config", "-c",
|
||||
type=Path,
|
||||
@ -211,6 +217,10 @@ def prune_crawlers(
|
||||
def main() -> None:
|
||||
args = PARSER.parse_args()
|
||||
|
||||
if args.version:
|
||||
print(f"{NAME} {VERSION}")
|
||||
exit()
|
||||
|
||||
try:
|
||||
config = Config(load_parser(args))
|
||||
except ConfigLoadException:
|
||||
|
@ -14,7 +14,7 @@ from .limiter import Limiter
|
||||
from .logging import ProgressBar, log
|
||||
from .output_dir import FileSink, OnConflict, OutputDirectory, Redownload
|
||||
from .transformer import Transformer
|
||||
from .version import __version__
|
||||
from .version import NAME, VERSION
|
||||
|
||||
|
||||
class CrawlWarning(Exception):
|
||||
@ -275,7 +275,7 @@ class HttpCrawler(Crawler):
|
||||
pass
|
||||
|
||||
async with aiohttp.ClientSession(
|
||||
headers={"User-Agent": f"pferd/{__version__}"},
|
||||
headers={"User-Agent": f"{NAME}/{VERSION}"},
|
||||
cookie_jar=cookie_jar,
|
||||
) as session:
|
||||
self.session = session
|
||||
|
@ -1 +1,2 @@
|
||||
__version__ = "3.0.0"
|
||||
NAME = "PFERD"
|
||||
VERSION = "3.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user