Skip to content

Commit 84ada3b

Browse files
committed
Add auto completion via argcomplete
1 parent cea3dca commit 84ada3b

3 files changed

Lines changed: 35 additions & 4 deletions

File tree

cliar/cliar.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from collections import OrderedDict
55
from typing import List, Iterable, Callable, Set, Type, get_type_hints
66

7+
import argcomplete
8+
79
from .utils import ignore
810

911

@@ -277,6 +279,8 @@ def _register_commands(self, handlers: Iterable[Callable]):
277279
def parse(self):
278280
'''Parse commandline input, i.e. launch the CLI.'''
279281

282+
argcomplete.autocomplete(self._parser)
283+
280284
args = self._parser.parse_args()
281285

282286
command = args._command

poetry.lock

Lines changed: 30 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ keywords = ["cli", "commandline"]
1212

1313
[tool.poetry.dependencies]
1414
python = "^3.6"
15+
argcomplete = "^1.12.0"
1516

1617
[tool.poetry.dev-dependencies]
1718
pytest = "^3.5"

0 commit comments

Comments
 (0)