pi-top-Python-SDK icon indicating copy to clipboard operation
pi-top-Python-SDK copied to clipboard

Add bash autocomplete to CLI

Open m-roberts opened this issue 4 years ago • 1 comments

See how pdm does this: https://pdm.fming.dev/#shell-completion We can combine this with some way to automatically add these lines to the OS.

shtab seems useful. This should be installed via setup.py, not via Debian package (unless this doesn't copy over to Debian package)

  • [ ] Add bash completion to extras/pitop.bash-completion
  • [ ] Add to setup.py:
diff --git a/setup.py b/setup.py
index eb33d32..d8da7ac 100644
--- a/setup.py
+++ b/
@@ -191,6 +191,9 @@ def main():
             setup_requires=['pytest-runner', 'flake8'],
             tests_require=['pytest'],
             entry_points=__entry_points__,
+            data_files=[
+                ('/usr/share/bash-completion/completions', ['extras/pitop.bash-completion']),
+            ],
         )
  • [ ] Review adding zsh completion
  • [ ] Workflow: run shtab to test if completions are up-to-date

m-roberts avatar Nov 26 '20 21:11 m-roberts

Include bash-completion in Build-Depends. Use dh $@ --with bash-completion in debian/rules. Use configuration file at debian/package.bash-completion.

https://www.debian.org/doc/manuals/maint-guide/dreq.en.html#rules

m-roberts avatar Jun 30 '21 13:06 m-roberts