From bf7d241049a9d4784a9f71691ccdaa749484f25e Mon Sep 17 00:00:00 2001 From: Piotr Machura Date: Sat, 28 Jan 2023 22:41:09 +0100 Subject: [PATCH] Add shell completion generation --- poetry.lock | 14 +++++++++++++- pyproject.toml | 3 ++- torrentmap/cli.py | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index fb50972..49cab4c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1211,6 +1211,18 @@ numpy = ">=1.14" docs = ["matplotlib", "numpydoc (>=1.1.0,<1.2.0)", "sphinx", "sphinx-book-theme", "sphinx-remove-toctrees"] test = ["pytest", "pytest-cov"] +[[package]] +name = "shtab" +version = "1.5.8" +description = "Automagic shell tab completion for Python CLI applications" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "shtab-1.5.8-py2.py3-none-any.whl", hash = "sha256:1d326ea131edbba96e0489470a2c969da1976a586a2d9376bb4923a6fe8eaae0"}, + {file = "shtab-1.5.8.tar.gz", hash = "sha256:1f944e2e33c1554be69e6b26ef638ba3b516ac9449fdd2a40d197f9061c8bed8"}, +] + [[package]] name = "six" version = "1.16.0" @@ -1365,4 +1377,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "8bb8dd312657adacce2161e809c021e790fb00580c1ebe7868ab1d1e2a57acdd" +content-hash = "36388ea46fb3b43898275a3b617628799d8c21be817fdb4b18a851667cd6ef3b" diff --git a/pyproject.toml b/pyproject.toml index d0d7178..f8dc9e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "torrentmap" -version = "1.0.1" +version = "1.0.2" description = "Torrent scraping and geolocation tool" authors = ["Piotr Machura "] license = "GPL-2.0-only" @@ -14,6 +14,7 @@ bitstring = "^4.0.1" geopandas = "^0.12.2" matplotlib = "^3.6.3" country-converter = "^0.8.0" +shtab = "^1.5.8" [tool.poetry.group.dev.dependencies] black = "^22.12.0" diff --git a/torrentmap/cli.py b/torrentmap/cli.py index 69bd43c..bf446bf 100644 --- a/torrentmap/cli.py +++ b/torrentmap/cli.py @@ -12,6 +12,7 @@ from os import environ as env from os import remove as rm from pathlib import Path +import shtab from .client import get_ips from .mapgen import worldmap from .torrent import Torrent @@ -160,7 +161,7 @@ def make_parser() -> argparse.ArgumentParser: help="Log file (defaul /dev/stderr)", ) parser.set_defaults(func=lambda _: parser.print_help()) - + shtab.add_argument_to(parser, ["--print-completion"]) subparsers = parser.add_subparsers() # LIST -- 2.45.2