Skip to content

Commit

Permalink
Add very simple shell completion using argcomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmcorvidae committed Dec 22, 2024
1 parent 749c6a7 commit 245a9e4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
7 changes: 7 additions & 0 deletions meshtastic/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
# pylint: disable=too-many-lines

import argparse
try:
import argcomplete
except ImportError as e:
argcomplete = None

import logging
import os
import platform
Expand Down Expand Up @@ -1961,6 +1966,8 @@ def initParser():

parser.set_defaults(deprecated=None)

if argcomplete is not None:
argcomplete.autocomplete(parser)
args = parser.parse_args()
mt_config.args = args
mt_config.parser = parser
Expand Down
18 changes: 16 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pyyaml = "^6.0.1"
pypubsub = "^4.0.3"
bleak = "^0.22.3"
packaging = "^24.0"
argcomplete = { version = "^3.5.2", optional = true }
pyqrcode = { version = "^1.2.1", optional = true }
dotmap = { version = "^1.3.30", optional = true }
print-color = { version = "^0.4.6", optional = true }
Expand Down Expand Up @@ -64,7 +65,7 @@ ipywidgets = "^8.1.3"
jupyterlab-widgets = "^3.0.11"

[tool.poetry.extras]
cli = ["pyqrcode", "print-color", "dotmap"]
cli = ["pyqrcode", "print-color", "dotmap", "argcomplete"]
tunnel = ["pytap2"]
analysis = ["dash", "dash-bootstrap-components", "pandas", "pandas-stubs"]

Expand Down

0 comments on commit 245a9e4

Please sign in to comment.