From: Andrea Righi Date: Thu, 15 Jun 2023 15:36:35 +0000 (+0200) Subject: annotations: add command line autocompletion X-Git-Tag: v0.1~12 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=ce02f2215bccd933bc77177feb9414f8754d9684;p=annotations.git annotations: add command line autocompletion Signed-off-by: Andrea Righi --- diff --git a/debian/control b/debian/control index f6de849..d5c16e2 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,7 @@ Section: misc Priority: optional Maintainer: Andrea Righi Standards-Version: 4.5.1 -Build-Depends: debhelper (>= 11), dh-python, python3, python3-setuptools +Build-Depends: debhelper (>= 11), dh-python, python3, python3-setuptools, python3-argcomplete Homepage: https://git.launchpad.net/~arighi/+git/annotations-tools Vcs-Git: https://git.launchpad.net/~arighi/+git/annotations-tools diff --git a/debian/rules b/debian/rules index 641186e..d3273c9 100755 --- a/debian/rules +++ b/debian/rules @@ -1,4 +1,12 @@ #!/usr/bin/make -f +annotations-prompt: + register-python-argcomplete annotations > $@ + %: dh $@ --with python3 --buildsystem=pybuild + +override_dh_install: annotations-prompt + dh_install + mkdir -p $(CURDIR)/debian/annotations/etc/bash_completion.d + install -m 0644 annotations-prompt $(CURDIR)/debian/annotations/etc/bash_completion.d/annotations-prompt diff --git a/kconfig/run.py b/kconfig/run.py index 86d8586..cf133b3 100644 --- a/kconfig/run.py +++ b/kconfig/run.py @@ -9,6 +9,7 @@ import os import argparse import json from signal import signal, SIGPIPE, SIG_DFL +from argcomplete import autocomplete from kconfig.annotations import Annotation, KConfig @@ -244,6 +245,7 @@ def main(): signal(SIGPIPE, SIG_DFL) # Main annotations program + autocomplete(_ARGPARSER) args = _ARGPARSER.parse_args() autodetect_annotations(args) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e60624f --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +argcomplete diff --git a/setup.py b/setup.py index 77fee4a..622a856 100755 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ setup( 'README.rst'), 'r').read(), long_description_content_type="text/x-rts", packages=['kconfig'], + install_requires=['argcomplete'], entry_points = { 'console_scripts': [ 'annotations = kconfig.run:main',