argcomplete 3.5.2__tar.gz → 3.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- argcomplete-3.6.0/.github/workflows/release.yml +21 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/Changes.rst +18 -0
- {argcomplete-3.5.2/argcomplete.egg-info → argcomplete-3.6.0}/PKG-INFO +24 -21
- {argcomplete-3.5.2 → argcomplete-3.6.0}/README.rst +6 -3
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/_check_module.py +8 -26
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/bash_completion.d/_python-argcomplete +6 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/completers.py +17 -4
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/packages/_argparse.py +1 -1
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/packages/_shlex.py +1 -1
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/scripts/python_argcomplete_check_easy_install_script.py +3 -3
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/shell_integration.py +6 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/common.mk +1 -7
- {argcomplete-3.5.2 → argcomplete-3.6.0}/pyproject.toml +11 -7
- argcomplete-3.6.0/setup.cfg +6 -0
- argcomplete-3.5.2/PKG-INFO +0 -351
- argcomplete-3.5.2/argcomplete.egg-info/SOURCES.txt +0 -64
- argcomplete-3.5.2/argcomplete.egg-info/dependency_links.txt +0 -1
- argcomplete-3.5.2/argcomplete.egg-info/entry_points.txt +0 -4
- argcomplete-3.5.2/argcomplete.egg-info/not-zip-safe +0 -1
- argcomplete-3.5.2/argcomplete.egg-info/requires.txt +0 -7
- argcomplete-3.5.2/argcomplete.egg-info/top_level.txt +0 -1
- argcomplete-3.5.2/setup.cfg +0 -11
- argcomplete-3.5.2/setup.py +0 -12
- argcomplete-3.5.2/test/test_package/test_module.py +0 -6
- argcomplete-3.5.2/test/test_package/test_package/__init__.py +0 -16
- argcomplete-3.5.2/test/test_package/test_package.egg-info/PKG-INFO +0 -3
- argcomplete-3.5.2/test/test_package/test_package.egg-info/SOURCES.txt +0 -8
- argcomplete-3.5.2/test/test_package/test_package.egg-info/dependency_links.txt +0 -1
- argcomplete-3.5.2/test/test_package/test_package.egg-info/entry_points.txt +0 -3
- argcomplete-3.5.2/test/test_package/test_package.egg-info/top_level.txt +0 -2
- {argcomplete-3.5.2 → argcomplete-3.6.0}/.github/FUNDING.yml +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/.github/workflows/ci.yml +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/.gitignore +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/Authors.rst +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/LICENSE.rst +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/MANIFEST.in +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/Makefile +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/NOTICE +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/SECURITY.md +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/__init__.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/_check_console_script.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/exceptions.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/finders.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/io.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/lexers.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/packages/__init__.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/py.typed +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/scripts/__init__.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/scripts/activate_global_python_argcomplete.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/scripts/register_python_argcomplete.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/contrib/README.rst +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/docs/changelog.rst +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/docs/conf.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/docs/examples/describe_github_user.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/docs/fish_help_string.png +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/docs/index.rst +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/docs/toc.html +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/test/__init__.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/test/inputrc +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/test/prog +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/test/stuck +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/test/test.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/test/test_contrib_shells.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/test/test_package/__init__.py +0 -0
- {argcomplete-3.5.2 → argcomplete-3.6.0}/test/test_package/setup.py +0 -0
- {argcomplete-3.5.2/test/test_package/build/lib → argcomplete-3.6.0/test/test_package}/test_module.py +0 -0
- {argcomplete-3.5.2/test/test_package/build/lib → argcomplete-3.6.0/test/test_package}/test_package/__init__.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Publish release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
pypi-publish:
|
|
10
|
+
name: Build and upload release to PyPI
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
environment: release
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
- run: pip install build
|
|
19
|
+
- run: python -m build
|
|
20
|
+
- name: Publish package distributions to PyPI
|
|
21
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
+
Changes for v3.6.0 (2025-03-05)
|
|
2
|
+
===============================
|
|
3
|
+
|
|
4
|
+
- Support namespace package traversal when completing Python entry
|
|
5
|
+
points
|
|
6
|
+
|
|
7
|
+
- zsh: skip repeat Python runs in the same completion run
|
|
8
|
+
|
|
9
|
+
- Make \_parse_known_args signature more general for future API changes
|
|
10
|
+
|
|
11
|
+
Changes for v3.5.3 (2024-12-31)
|
|
12
|
+
===============================
|
|
13
|
+
|
|
14
|
+
- Use interactive shells and bind to make environment variable name
|
|
15
|
+
completions work in older Bash versions (#506)
|
|
16
|
+
|
|
1
17
|
Changes for v3.5.2 (2024-12-06)
|
|
2
18
|
===============================
|
|
3
19
|
|
|
4
20
|
- Fix \_parse_known_args monkeypatching
|
|
5
21
|
|
|
22
|
+
- Note: This fix is required to restore compatibility with Python 3.12.8 and 3.13.1.
|
|
23
|
+
|
|
6
24
|
- CI improvements
|
|
7
25
|
|
|
8
26
|
Changes for v3.5.1 (2024-10-06)
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: argcomplete
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.6.0
|
|
4
4
|
Summary: Bash tab completion for argparse
|
|
5
|
-
|
|
6
|
-
Author: Andrey Kislyuk
|
|
7
|
-
Author-email: kislyuk@gmail.com
|
|
8
|
-
License: Apache Software License
|
|
5
|
+
Project-URL: Homepage, https://github.com/kislyuk/argcomplete
|
|
9
6
|
Project-URL: Documentation, https://kislyuk.github.io/argcomplete
|
|
10
7
|
Project-URL: Source Code, https://github.com/kislyuk/argcomplete
|
|
11
8
|
Project-URL: Issue Tracker, https://github.com/kislyuk/argcomplete/issues
|
|
12
9
|
Project-URL: Change Log, https://github.com/kislyuk/argcomplete/blob/develop/Changes.rst
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
Author: Andrey Kislyuk
|
|
11
|
+
Author-email: kislyuk@gmail.com
|
|
12
|
+
Maintainer: Andrey Kislyuk
|
|
13
|
+
Maintainer-email: kislyuk@gmail.com
|
|
14
|
+
License: Apache Software License
|
|
15
|
+
License-File: LICENSE.rst
|
|
16
|
+
License-File: NOTICE
|
|
17
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
18
|
Classifier: Environment :: Console
|
|
16
19
|
Classifier: Intended Audience :: Developers
|
|
17
20
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -19,29 +22,26 @@ Classifier: Operating System :: MacOS :: MacOS X
|
|
|
19
22
|
Classifier: Operating System :: POSIX
|
|
20
23
|
Classifier: Programming Language :: Python
|
|
21
24
|
Classifier: Programming Language :: Python :: 3
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
23
25
|
Classifier: Programming Language :: Python :: 3.8
|
|
24
26
|
Classifier: Programming Language :: Python :: 3.9
|
|
25
27
|
Classifier: Programming Language :: Python :: 3.10
|
|
26
28
|
Classifier: Programming Language :: Python :: 3.11
|
|
27
29
|
Classifier: Programming Language :: Python :: 3.12
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
28
31
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
29
32
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
30
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
31
33
|
Classifier: Topic :: Software Development
|
|
32
34
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
35
|
Classifier: Topic :: System :: Shells
|
|
34
36
|
Classifier: Topic :: Terminals
|
|
35
37
|
Requires-Python: >=3.8
|
|
36
|
-
Description-Content-Type: text/x-rst
|
|
37
|
-
License-File: LICENSE.rst
|
|
38
|
-
License-File: NOTICE
|
|
39
38
|
Provides-Extra: test
|
|
40
|
-
Requires-Dist: coverage; extra ==
|
|
41
|
-
Requires-Dist:
|
|
42
|
-
Requires-Dist:
|
|
43
|
-
Requires-Dist: ruff; extra ==
|
|
44
|
-
Requires-Dist:
|
|
39
|
+
Requires-Dist: coverage; extra == 'test'
|
|
40
|
+
Requires-Dist: mypy; extra == 'test'
|
|
41
|
+
Requires-Dist: pexpect; extra == 'test'
|
|
42
|
+
Requires-Dist: ruff; extra == 'test'
|
|
43
|
+
Requires-Dist: wheel; extra == 'test'
|
|
44
|
+
Description-Content-Type: text/x-rst
|
|
45
45
|
|
|
46
46
|
argcomplete - Bash/zsh tab completion for argparse
|
|
47
47
|
==================================================
|
|
@@ -85,6 +85,9 @@ follows:
|
|
|
85
85
|
args = parser.parse_args()
|
|
86
86
|
...
|
|
87
87
|
|
|
88
|
+
If using ``pyproject.toml`` ``[project.scripts]`` entry points, the ``PYTHON_ARGCOMPLETE_OK`` marker should appear
|
|
89
|
+
at the beginning of the file that contains the entry point.
|
|
90
|
+
|
|
88
91
|
Register your Python application with your shell's completion framework by running ``register-python-argcomplete``::
|
|
89
92
|
|
|
90
93
|
eval "$(register-python-argcomplete my-python-app)"
|
|
@@ -268,9 +271,9 @@ multiple Python versions on the same system, the version being used to run the s
|
|
|
268
271
|
``/etc/shells``, and run ``chsh`` to change your shell). You can check the version of the running copy of bash with
|
|
269
272
|
``echo $BASH_VERSION``.
|
|
270
273
|
|
|
271
|
-
.. note:: If you use
|
|
274
|
+
.. note:: If you use ``project.scripts`` directives to provide command line entry points to your package,
|
|
272
275
|
argcomplete will follow the wrapper scripts to their destination and look for ``PYTHON_ARGCOMPLETE_OK`` in the
|
|
273
|
-
destination code.
|
|
276
|
+
first kilobyte of the file containing the destination code.
|
|
274
277
|
|
|
275
278
|
If you choose not to use global completion, or ship a completion module that depends on argcomplete, you must register
|
|
276
279
|
your script explicitly using ``eval "$(register-python-argcomplete my-python-app)"``. Standard completion module
|
|
@@ -295,7 +298,7 @@ work for zsh as well.
|
|
|
295
298
|
|
|
296
299
|
Python Support
|
|
297
300
|
--------------
|
|
298
|
-
Argcomplete requires Python 3.
|
|
301
|
+
Argcomplete requires Python 3.9+.
|
|
299
302
|
|
|
300
303
|
Support for other shells
|
|
301
304
|
------------------------
|
|
@@ -40,6 +40,9 @@ follows:
|
|
|
40
40
|
args = parser.parse_args()
|
|
41
41
|
...
|
|
42
42
|
|
|
43
|
+
If using ``pyproject.toml`` ``[project.scripts]`` entry points, the ``PYTHON_ARGCOMPLETE_OK`` marker should appear
|
|
44
|
+
at the beginning of the file that contains the entry point.
|
|
45
|
+
|
|
43
46
|
Register your Python application with your shell's completion framework by running ``register-python-argcomplete``::
|
|
44
47
|
|
|
45
48
|
eval "$(register-python-argcomplete my-python-app)"
|
|
@@ -223,9 +226,9 @@ multiple Python versions on the same system, the version being used to run the s
|
|
|
223
226
|
``/etc/shells``, and run ``chsh`` to change your shell). You can check the version of the running copy of bash with
|
|
224
227
|
``echo $BASH_VERSION``.
|
|
225
228
|
|
|
226
|
-
.. note:: If you use
|
|
229
|
+
.. note:: If you use ``project.scripts`` directives to provide command line entry points to your package,
|
|
227
230
|
argcomplete will follow the wrapper scripts to their destination and look for ``PYTHON_ARGCOMPLETE_OK`` in the
|
|
228
|
-
destination code.
|
|
231
|
+
first kilobyte of the file containing the destination code.
|
|
229
232
|
|
|
230
233
|
If you choose not to use global completion, or ship a completion module that depends on argcomplete, you must register
|
|
231
234
|
your script explicitly using ``eval "$(register-python-argcomplete my-python-app)"``. Standard completion module
|
|
@@ -250,7 +253,7 @@ work for zsh as well.
|
|
|
250
253
|
|
|
251
254
|
Python Support
|
|
252
255
|
--------------
|
|
253
|
-
Argcomplete requires Python 3.
|
|
256
|
+
Argcomplete requires Python 3.9+.
|
|
254
257
|
|
|
255
258
|
Support for other shells
|
|
256
259
|
------------------------
|
|
@@ -10,30 +10,7 @@ Intended to be invoked by argcomplete's global completion function.
|
|
|
10
10
|
import os
|
|
11
11
|
import sys
|
|
12
12
|
import tokenize
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
from importlib.util import find_spec # type:ignore
|
|
16
|
-
except ImportError:
|
|
17
|
-
import typing as t
|
|
18
|
-
from collections import namedtuple
|
|
19
|
-
from imp import find_module # type:ignore
|
|
20
|
-
|
|
21
|
-
ModuleSpec = namedtuple("ModuleSpec", ["origin", "has_location", "submodule_search_locations"])
|
|
22
|
-
|
|
23
|
-
def find_spec( # type:ignore
|
|
24
|
-
name: str,
|
|
25
|
-
package: t.Optional[str] = None,
|
|
26
|
-
) -> t.Optional[ModuleSpec]:
|
|
27
|
-
"""Minimal implementation as required by `find`."""
|
|
28
|
-
try:
|
|
29
|
-
f, path, _ = find_module(name)
|
|
30
|
-
except ImportError:
|
|
31
|
-
return None
|
|
32
|
-
has_location = path is not None
|
|
33
|
-
if f is None:
|
|
34
|
-
return ModuleSpec(None, has_location, [path])
|
|
35
|
-
f.close()
|
|
36
|
-
return ModuleSpec(path, has_location, None)
|
|
13
|
+
from importlib.util import find_spec
|
|
37
14
|
|
|
38
15
|
|
|
39
16
|
class ArgcompleteMarkerNotFound(RuntimeError):
|
|
@@ -42,7 +19,12 @@ class ArgcompleteMarkerNotFound(RuntimeError):
|
|
|
42
19
|
|
|
43
20
|
def find(name, return_package=False):
|
|
44
21
|
names = name.split(".")
|
|
45
|
-
|
|
22
|
+
# Look for the first importlib ModuleSpec that has `origin` set, indicating it's not a namespace package.
|
|
23
|
+
for package_name_boundary in range(len(names)):
|
|
24
|
+
spec = find_spec(".".join(names[: package_name_boundary + 1]))
|
|
25
|
+
if spec is not None and spec.origin is not None:
|
|
26
|
+
break
|
|
27
|
+
|
|
46
28
|
if spec is None:
|
|
47
29
|
raise ArgcompleteMarkerNotFound('no module named "{}"'.format(names[0]))
|
|
48
30
|
if not spec.has_location:
|
|
@@ -53,7 +35,7 @@ def find(name, return_package=False):
|
|
|
53
35
|
return spec.origin
|
|
54
36
|
if len(spec.submodule_search_locations) != 1:
|
|
55
37
|
raise ArgcompleteMarkerNotFound("expecting one search location")
|
|
56
|
-
path = os.path.join(spec.submodule_search_locations[0], *names[1:])
|
|
38
|
+
path = os.path.join(spec.submodule_search_locations[0], *names[package_name_boundary + 1 :])
|
|
57
39
|
if os.path.isdir(path):
|
|
58
40
|
filename = "__main__.py"
|
|
59
41
|
if return_package:
|
|
@@ -124,6 +124,12 @@ __python_argcomplete_which() {
|
|
|
124
124
|
_python_argcomplete_global() {
|
|
125
125
|
|
|
126
126
|
if [[ -n "${ZSH_VERSION-}" ]]; then
|
|
127
|
+
if [[ "${_matcher_num-}" -gt 1 ]]; then
|
|
128
|
+
# Return early if the completer is called multiple times in the same completion run.
|
|
129
|
+
# Currently the only known occurrence of this is in zsh when a matcher-list zstyle is declared.
|
|
130
|
+
# When this happens, _matcher_num is incremented past 1.
|
|
131
|
+
return
|
|
132
|
+
fi
|
|
127
133
|
# Store result of a regex match in the
|
|
128
134
|
# BASH_REMATCH variable rather than MATCH
|
|
129
135
|
setopt local_options BASH_REMATCH
|
|
@@ -59,13 +59,26 @@ class FilesCompleter(BaseCompleter):
|
|
|
59
59
|
completion = []
|
|
60
60
|
if self.allowednames:
|
|
61
61
|
if self.directories:
|
|
62
|
-
|
|
62
|
+
# Using 'bind' in this and the following commands is a workaround to a bug in bash
|
|
63
|
+
# that was fixed in bash 5.3 but affects older versions. Environment variables are not treated
|
|
64
|
+
# correctly in older versions and calling bind makes them available. For details, see
|
|
65
|
+
# https://savannah.gnu.org/support/index.php?111125
|
|
66
|
+
files = _call(
|
|
67
|
+
["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL
|
|
68
|
+
)
|
|
63
69
|
completion += [f + "/" for f in files]
|
|
64
70
|
for x in self.allowednames:
|
|
65
|
-
completion += _call(
|
|
71
|
+
completion += _call(
|
|
72
|
+
["bash", "-c", "bind; compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix)],
|
|
73
|
+
stderr=subprocess.DEVNULL,
|
|
74
|
+
)
|
|
66
75
|
else:
|
|
67
|
-
completion += _call(
|
|
68
|
-
|
|
76
|
+
completion += _call(
|
|
77
|
+
["bash", "-c", "bind; compgen -A file -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL
|
|
78
|
+
)
|
|
79
|
+
anticomp = _call(
|
|
80
|
+
["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL
|
|
81
|
+
)
|
|
69
82
|
completion = list(set(completion) - set(anticomp))
|
|
70
83
|
|
|
71
84
|
if self.directories:
|
|
@@ -75,7 +75,7 @@ class IntrospectiveArgumentParser(ArgumentParser):
|
|
|
75
75
|
except for the lines that contain the string "Added by argcomplete".
|
|
76
76
|
'''
|
|
77
77
|
|
|
78
|
-
def _parse_known_args(self, arg_strings, namespace, intermixed=False):
|
|
78
|
+
def _parse_known_args(self, arg_strings, namespace, intermixed=False, **kwargs):
|
|
79
79
|
_num_consumed_args.clear() # Added by argcomplete
|
|
80
80
|
self._argcomplete_namespace = namespace
|
|
81
81
|
self.active_actions: List[Action] = [] # Added by argcomplete
|
|
@@ -36,7 +36,7 @@ class shlex:
|
|
|
36
36
|
else:
|
|
37
37
|
self.eof = ''
|
|
38
38
|
self.commenters = '#'
|
|
39
|
-
self.wordchars = '
|
|
39
|
+
self.wordchars = 'abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'
|
|
40
40
|
# Modified by argcomplete: 2/3 compatibility
|
|
41
41
|
# if self.posix:
|
|
42
42
|
# self.wordchars += ('ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ'
|
|
@@ -33,7 +33,7 @@ def main():
|
|
|
33
33
|
lines = head.split("\n", 12)
|
|
34
34
|
for line in lines:
|
|
35
35
|
if line.startswith("# EASY-INSTALL-SCRIPT"):
|
|
36
|
-
import pkg_resources
|
|
36
|
+
import pkg_resources # type: ignore
|
|
37
37
|
|
|
38
38
|
re_match = re.match("# EASY-INSTALL-SCRIPT: '(.+)','(.+)'", line)
|
|
39
39
|
assert re_match is not None
|
|
@@ -48,7 +48,7 @@ def main():
|
|
|
48
48
|
dist, group, name = re_match.groups()
|
|
49
49
|
import pkgutil
|
|
50
50
|
|
|
51
|
-
import pkg_resources
|
|
51
|
+
import pkg_resources # type: ignore
|
|
52
52
|
|
|
53
53
|
entry_point_info = pkg_resources.get_distribution(dist).get_entry_info(group, name)
|
|
54
54
|
assert entry_point_info is not None
|
|
@@ -71,7 +71,7 @@ def main():
|
|
|
71
71
|
module = re_match.groups()[0]
|
|
72
72
|
import pkgutil
|
|
73
73
|
|
|
74
|
-
import pkg_resources
|
|
74
|
+
import pkg_resources # type: ignore
|
|
75
75
|
|
|
76
76
|
with open(pkgutil.get_loader(module).get_filename()) as mod_fh: # type: ignore
|
|
77
77
|
if "PYTHON_ARGCOMPLETE_OK" in mod_fh.read(1024):
|
|
@@ -34,6 +34,12 @@ _python_argcomplete%(function_suffix)s() {
|
|
|
34
34
|
local IFS=$'\013'
|
|
35
35
|
local script="%(argcomplete_script)s"
|
|
36
36
|
if [[ -n "${ZSH_VERSION-}" ]]; then
|
|
37
|
+
if [[ "${_matcher_num-}" -gt 1 ]]; then
|
|
38
|
+
# Return early if the completer is called multiple times in the same completion run.
|
|
39
|
+
# Currently the only known occurrence of this is in zsh when a matcher-list zstyle is declared.
|
|
40
|
+
# When this happens, _matcher_num is incremented past 1.
|
|
41
|
+
return
|
|
42
|
+
fi
|
|
37
43
|
local completions
|
|
38
44
|
completions=($(IFS="$IFS" \
|
|
39
45
|
COMP_LINE="$BUFFER" \
|
|
@@ -18,9 +18,8 @@ release:
|
|
|
18
18
|
@if ! type -P pandoc; then echo "Please install pandoc"; exit 1; fi
|
|
19
19
|
@if ! type -P sponge; then echo "Please install moreutils"; exit 1; fi
|
|
20
20
|
@if ! type -P gh; then echo "Please install gh"; exit 1; fi
|
|
21
|
-
@if ! type -P twine; then echo "Please install twine"; exit 1; fi
|
|
22
21
|
git pull
|
|
23
|
-
git clean -x --force
|
|
22
|
+
git clean -x --force argcomplete
|
|
24
23
|
TAG_MSG=$$(mktemp); \
|
|
25
24
|
echo "# Changes for ${TAG} ($$(date +%Y-%m-%d))" > $$TAG_MSG; \
|
|
26
25
|
git log --pretty=format:%s $$(git describe --abbrev=0)..HEAD >> $$TAG_MSG; \
|
|
@@ -32,13 +31,8 @@ release:
|
|
|
32
31
|
git push --follow-tags
|
|
33
32
|
$(MAKE) install
|
|
34
33
|
gh release create ${TAG} dist/*.whl --notes="$$(git tag --list ${TAG} -n99 | perl -pe 's/^\S+\s*// if $$. == 1' | sed 's/^\s\s\s\s//')"
|
|
35
|
-
$(MAKE) release-pypi
|
|
36
34
|
$(MAKE) release-docs
|
|
37
35
|
|
|
38
|
-
release-pypi:
|
|
39
|
-
python -m build
|
|
40
|
-
twine upload dist/*.tar.gz dist/*.whl --verbose
|
|
41
|
-
|
|
42
36
|
release-docs:
|
|
43
37
|
$(MAKE) docs
|
|
44
38
|
-git branch -D gh-pages
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=67.7.2", "setuptools_scm[toml]>=6.2"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
1
|
[project]
|
|
6
2
|
name = "argcomplete"
|
|
7
3
|
description = "Bash tab completion for argparse"
|
|
@@ -9,7 +5,7 @@ readme = "README.rst"
|
|
|
9
5
|
requires-python = ">=3.8"
|
|
10
6
|
license = { text = "Apache Software License" }
|
|
11
7
|
authors = [{ name = "Andrey Kislyuk"}, {email = "kislyuk@gmail.com" }]
|
|
12
|
-
maintainers = []
|
|
8
|
+
maintainers = [{ name = "Andrey Kislyuk"}, {email = "kislyuk@gmail.com" }]
|
|
13
9
|
dynamic = ["version"]
|
|
14
10
|
classifiers = [
|
|
15
11
|
"Environment :: Console",
|
|
@@ -19,12 +15,12 @@ classifiers = [
|
|
|
19
15
|
"Operating System :: POSIX",
|
|
20
16
|
"Programming Language :: Python",
|
|
21
17
|
"Programming Language :: Python :: 3",
|
|
22
|
-
"Programming Language :: Python :: 3.7",
|
|
23
18
|
"Programming Language :: Python :: 3.8",
|
|
24
19
|
"Programming Language :: Python :: 3.9",
|
|
25
20
|
"Programming Language :: Python :: 3.10",
|
|
26
21
|
"Programming Language :: Python :: 3.11",
|
|
27
22
|
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
28
24
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
29
25
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
30
26
|
"Development Status :: 5 - Production/Stable",
|
|
@@ -43,12 +39,18 @@ register-python-argcomplete = "argcomplete.scripts.register_python_argcomplete:m
|
|
|
43
39
|
test = ["coverage", "pexpect", "wheel", "ruff", "mypy"]
|
|
44
40
|
|
|
45
41
|
[project.urls]
|
|
42
|
+
"Homepage"= "https://github.com/kislyuk/argcomplete"
|
|
46
43
|
"Documentation"= "https://kislyuk.github.io/argcomplete"
|
|
47
44
|
"Source Code"= "https://github.com/kislyuk/argcomplete"
|
|
48
45
|
"Issue Tracker"= "https://github.com/kislyuk/argcomplete/issues"
|
|
49
46
|
"Change Log"= "https://github.com/kislyuk/argcomplete/blob/develop/Changes.rst"
|
|
50
47
|
|
|
51
|
-
[
|
|
48
|
+
[build-system]
|
|
49
|
+
requires = ["hatchling", "hatch-vcs"]
|
|
50
|
+
build-backend = "hatchling.build"
|
|
51
|
+
|
|
52
|
+
[tool.hatch.version]
|
|
53
|
+
source = "vcs"
|
|
52
54
|
|
|
53
55
|
[tool.black]
|
|
54
56
|
line-length = 120
|
|
@@ -62,6 +64,8 @@ skip = ".*/version.py"
|
|
|
62
64
|
|
|
63
65
|
[tool.ruff]
|
|
64
66
|
line-length = 120
|
|
67
|
+
|
|
68
|
+
[tool.ruff.lint]
|
|
65
69
|
per-file-ignores = {"argcomplete/__init__.py" = ["F401"]}
|
|
66
70
|
|
|
67
71
|
[tool.ruff.format]
|
argcomplete-3.5.2/PKG-INFO
DELETED
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: argcomplete
|
|
3
|
-
Version: 3.5.2
|
|
4
|
-
Summary: Bash tab completion for argparse
|
|
5
|
-
Home-page: https://github.com/kislyuk/argcomplete
|
|
6
|
-
Author: Andrey Kislyuk
|
|
7
|
-
Author-email: kislyuk@gmail.com
|
|
8
|
-
License: Apache Software License
|
|
9
|
-
Project-URL: Documentation, https://kislyuk.github.io/argcomplete
|
|
10
|
-
Project-URL: Source Code, https://github.com/kislyuk/argcomplete
|
|
11
|
-
Project-URL: Issue Tracker, https://github.com/kislyuk/argcomplete/issues
|
|
12
|
-
Project-URL: Change Log, https://github.com/kislyuk/argcomplete/blob/develop/Changes.rst
|
|
13
|
-
Platform: MacOS X
|
|
14
|
-
Platform: Posix
|
|
15
|
-
Classifier: Environment :: Console
|
|
16
|
-
Classifier: Intended Audience :: Developers
|
|
17
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
18
|
-
Classifier: Operating System :: MacOS :: MacOS X
|
|
19
|
-
Classifier: Operating System :: POSIX
|
|
20
|
-
Classifier: Programming Language :: Python
|
|
21
|
-
Classifier: Programming Language :: Python :: 3
|
|
22
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
23
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
25
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
26
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
27
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
28
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
29
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
30
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
31
|
-
Classifier: Topic :: Software Development
|
|
32
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
33
|
-
Classifier: Topic :: System :: Shells
|
|
34
|
-
Classifier: Topic :: Terminals
|
|
35
|
-
Requires-Python: >=3.8
|
|
36
|
-
Description-Content-Type: text/x-rst
|
|
37
|
-
License-File: LICENSE.rst
|
|
38
|
-
License-File: NOTICE
|
|
39
|
-
Provides-Extra: test
|
|
40
|
-
Requires-Dist: coverage; extra == "test"
|
|
41
|
-
Requires-Dist: pexpect; extra == "test"
|
|
42
|
-
Requires-Dist: wheel; extra == "test"
|
|
43
|
-
Requires-Dist: ruff; extra == "test"
|
|
44
|
-
Requires-Dist: mypy; extra == "test"
|
|
45
|
-
|
|
46
|
-
argcomplete - Bash/zsh tab completion for argparse
|
|
47
|
-
==================================================
|
|
48
|
-
*Tab complete all the things!*
|
|
49
|
-
|
|
50
|
-
Argcomplete provides easy, extensible command line tab completion of arguments for your Python application.
|
|
51
|
-
|
|
52
|
-
It makes two assumptions:
|
|
53
|
-
|
|
54
|
-
* You're using bash or zsh as your shell
|
|
55
|
-
* You're using `argparse <http://docs.python.org/3/library/argparse.html>`_ to manage your command line arguments/options
|
|
56
|
-
|
|
57
|
-
Argcomplete is particularly useful if your program has lots of options or subparsers, and if your program can
|
|
58
|
-
dynamically suggest completions for your argument/option values (for example, if the user is browsing resources over
|
|
59
|
-
the network).
|
|
60
|
-
|
|
61
|
-
Installation
|
|
62
|
-
------------
|
|
63
|
-
::
|
|
64
|
-
|
|
65
|
-
pip install argcomplete
|
|
66
|
-
activate-global-python-argcomplete
|
|
67
|
-
|
|
68
|
-
See `Activating global completion`_ below for details about the second step.
|
|
69
|
-
|
|
70
|
-
Refresh your shell environment (start a new shell).
|
|
71
|
-
|
|
72
|
-
Synopsis
|
|
73
|
-
--------
|
|
74
|
-
Add the ``PYTHON_ARGCOMPLETE_OK`` marker and a call to ``argcomplete.autocomplete()`` to your Python application as
|
|
75
|
-
follows:
|
|
76
|
-
|
|
77
|
-
.. code-block:: python
|
|
78
|
-
|
|
79
|
-
#!/usr/bin/env python
|
|
80
|
-
# PYTHON_ARGCOMPLETE_OK
|
|
81
|
-
import argcomplete, argparse
|
|
82
|
-
parser = argparse.ArgumentParser()
|
|
83
|
-
...
|
|
84
|
-
argcomplete.autocomplete(parser)
|
|
85
|
-
args = parser.parse_args()
|
|
86
|
-
...
|
|
87
|
-
|
|
88
|
-
Register your Python application with your shell's completion framework by running ``register-python-argcomplete``::
|
|
89
|
-
|
|
90
|
-
eval "$(register-python-argcomplete my-python-app)"
|
|
91
|
-
|
|
92
|
-
Quotes are significant; the registration will fail without them. See `Global completion`_ below for a way to enable
|
|
93
|
-
argcomplete generally without registering each application individually.
|
|
94
|
-
|
|
95
|
-
argcomplete.autocomplete(*parser*)
|
|
96
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
97
|
-
This method is the entry point to the module. It must be called **after** ArgumentParser construction is complete, but
|
|
98
|
-
**before** the ``ArgumentParser.parse_args()`` method is called. The method looks for an environment variable that the
|
|
99
|
-
completion hook shellcode sets, and if it's there, collects completions, prints them to the output stream (fd 8 by
|
|
100
|
-
default), and exits. Otherwise, it returns to the caller immediately.
|
|
101
|
-
|
|
102
|
-
.. admonition:: Side effects
|
|
103
|
-
|
|
104
|
-
Argcomplete gets completions by running your program. It intercepts the execution flow at the moment
|
|
105
|
-
``argcomplete.autocomplete()`` is called. After sending completions, it exits using ``exit_method`` (``os._exit``
|
|
106
|
-
by default). This means if your program has any side effects that happen before ``argcomplete`` is called, those
|
|
107
|
-
side effects will happen every time the user presses ``<TAB>`` (although anything your program prints to stdout or
|
|
108
|
-
stderr will be suppressed). For this reason it's best to construct the argument parser and call
|
|
109
|
-
``argcomplete.autocomplete()`` as early as possible in your execution flow.
|
|
110
|
-
|
|
111
|
-
.. admonition:: Performance
|
|
112
|
-
|
|
113
|
-
If the program takes a long time to get to the point where ``argcomplete.autocomplete()`` is called, the tab completion
|
|
114
|
-
process will feel sluggish, and the user may lose confidence in it. So it's also important to minimize the startup time
|
|
115
|
-
of the program up to that point (for example, by deferring initialization or importing of large modules until after
|
|
116
|
-
parsing options).
|
|
117
|
-
|
|
118
|
-
Specifying completers
|
|
119
|
-
---------------------
|
|
120
|
-
You can specify custom completion functions for your options and arguments. Two styles are supported: callable and
|
|
121
|
-
readline-style. Callable completers are simpler. They are called with the following keyword arguments:
|
|
122
|
-
|
|
123
|
-
* ``prefix``: The prefix text of the last word before the cursor on the command line.
|
|
124
|
-
For dynamic completers, this can be used to reduce the work required to generate possible completions.
|
|
125
|
-
* ``action``: The ``argparse.Action`` instance that this completer was called for.
|
|
126
|
-
* ``parser``: The ``argparse.ArgumentParser`` instance that the action was taken by.
|
|
127
|
-
* ``parsed_args``: The result of argument parsing so far (the ``argparse.Namespace`` args object normally returned by
|
|
128
|
-
``ArgumentParser.parse_args()``).
|
|
129
|
-
|
|
130
|
-
Completers can return their completions as an iterable of strings or a mapping (dict) of strings to their
|
|
131
|
-
descriptions (zsh will display the descriptions as context help alongside completions). An example completer for names
|
|
132
|
-
of environment variables might look like this:
|
|
133
|
-
|
|
134
|
-
.. code-block:: python
|
|
135
|
-
|
|
136
|
-
def EnvironCompleter(**kwargs):
|
|
137
|
-
return os.environ
|
|
138
|
-
|
|
139
|
-
To specify a completer for an argument or option, set the ``completer`` attribute of its associated action. An easy
|
|
140
|
-
way to do this at definition time is:
|
|
141
|
-
|
|
142
|
-
.. code-block:: python
|
|
143
|
-
|
|
144
|
-
from argcomplete.completers import EnvironCompleter
|
|
145
|
-
|
|
146
|
-
parser = argparse.ArgumentParser()
|
|
147
|
-
parser.add_argument("--env-var1").completer = EnvironCompleter
|
|
148
|
-
parser.add_argument("--env-var2").completer = EnvironCompleter
|
|
149
|
-
argcomplete.autocomplete(parser)
|
|
150
|
-
|
|
151
|
-
If you specify the ``choices`` keyword for an argparse option or argument (and don't specify a completer), it will be
|
|
152
|
-
used for completions.
|
|
153
|
-
|
|
154
|
-
A completer that is initialized with a set of all possible choices of values for its action might look like this:
|
|
155
|
-
|
|
156
|
-
.. code-block:: python
|
|
157
|
-
|
|
158
|
-
class ChoicesCompleter(object):
|
|
159
|
-
def __init__(self, choices):
|
|
160
|
-
self.choices = choices
|
|
161
|
-
|
|
162
|
-
def __call__(self, **kwargs):
|
|
163
|
-
return self.choices
|
|
164
|
-
|
|
165
|
-
The following two ways to specify a static set of choices are equivalent for completion purposes:
|
|
166
|
-
|
|
167
|
-
.. code-block:: python
|
|
168
|
-
|
|
169
|
-
from argcomplete.completers import ChoicesCompleter
|
|
170
|
-
|
|
171
|
-
parser.add_argument("--protocol", choices=('http', 'https', 'ssh', 'rsync', 'wss'))
|
|
172
|
-
parser.add_argument("--proto").completer=ChoicesCompleter(('http', 'https', 'ssh', 'rsync', 'wss'))
|
|
173
|
-
|
|
174
|
-
Note that if you use the ``choices=<completions>`` option, argparse will show
|
|
175
|
-
all these choices in the ``--help`` output by default. To prevent this, set
|
|
176
|
-
``metavar`` (like ``parser.add_argument("--protocol", metavar="PROTOCOL",
|
|
177
|
-
choices=('http', 'https', 'ssh', 'rsync', 'wss'))``).
|
|
178
|
-
|
|
179
|
-
The following `script <https://raw.github.com/kislyuk/argcomplete/master/docs/examples/describe_github_user.py>`_ uses
|
|
180
|
-
``parsed_args`` and `Requests <http://python-requests.org/>`_ to query GitHub for publicly known members of an
|
|
181
|
-
organization and complete their names, then prints the member description:
|
|
182
|
-
|
|
183
|
-
.. code-block:: python
|
|
184
|
-
|
|
185
|
-
#!/usr/bin/env python
|
|
186
|
-
# PYTHON_ARGCOMPLETE_OK
|
|
187
|
-
import argcomplete, argparse, requests, pprint
|
|
188
|
-
|
|
189
|
-
def github_org_members(prefix, parsed_args, **kwargs):
|
|
190
|
-
resource = "https://api.github.com/orgs/{org}/members".format(org=parsed_args.organization)
|
|
191
|
-
return (member['login'] for member in requests.get(resource).json() if member['login'].startswith(prefix))
|
|
192
|
-
|
|
193
|
-
parser = argparse.ArgumentParser()
|
|
194
|
-
parser.add_argument("--organization", help="GitHub organization")
|
|
195
|
-
parser.add_argument("--member", help="GitHub member").completer = github_org_members
|
|
196
|
-
|
|
197
|
-
argcomplete.autocomplete(parser)
|
|
198
|
-
args = parser.parse_args()
|
|
199
|
-
|
|
200
|
-
pprint.pprint(requests.get("https://api.github.com/users/{m}".format(m=args.member)).json())
|
|
201
|
-
|
|
202
|
-
`Try it <https://raw.github.com/kislyuk/argcomplete/master/docs/examples/describe_github_user.py>`_ like this::
|
|
203
|
-
|
|
204
|
-
./describe_github_user.py --organization heroku --member <TAB>
|
|
205
|
-
|
|
206
|
-
If you have a useful completer to add to the `completer library
|
|
207
|
-
<https://github.com/kislyuk/argcomplete/blob/master/argcomplete/completers.py>`_, send a pull request!
|
|
208
|
-
|
|
209
|
-
Readline-style completers
|
|
210
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
211
|
-
The readline_ module defines a completer protocol in rlcompleter_. Readline-style completers are also supported by
|
|
212
|
-
argcomplete, so you can use the same completer object both in an interactive readline-powered shell and on the command
|
|
213
|
-
line. For example, you can use the readline-style completer provided by IPython_ to get introspective completions like
|
|
214
|
-
you would get in the IPython shell:
|
|
215
|
-
|
|
216
|
-
.. _readline: http://docs.python.org/3/library/readline.html
|
|
217
|
-
.. _rlcompleter: http://docs.python.org/3/library/rlcompleter.html#completer-objects
|
|
218
|
-
.. _IPython: http://ipython.org/
|
|
219
|
-
|
|
220
|
-
.. code-block:: python
|
|
221
|
-
|
|
222
|
-
import IPython
|
|
223
|
-
parser.add_argument("--python-name").completer = IPython.core.completer.Completer()
|
|
224
|
-
|
|
225
|
-
``argcomplete.CompletionFinder.rl_complete`` can also be used to plug in an argparse parser as a readline completer.
|
|
226
|
-
|
|
227
|
-
Printing warnings in completers
|
|
228
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
229
|
-
Normal stdout/stderr output is suspended when argcomplete runs. Sometimes, though, when the user presses ``<TAB>``, it's
|
|
230
|
-
appropriate to print information about why completions generation failed. To do this, use ``warn``:
|
|
231
|
-
|
|
232
|
-
.. code-block:: python
|
|
233
|
-
|
|
234
|
-
from argcomplete import warn
|
|
235
|
-
|
|
236
|
-
def AwesomeWebServiceCompleter(prefix, **kwargs):
|
|
237
|
-
if login_failed:
|
|
238
|
-
warn("Please log in to Awesome Web Service to use autocompletion")
|
|
239
|
-
return completions
|
|
240
|
-
|
|
241
|
-
Using a custom completion validator
|
|
242
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
243
|
-
By default, argcomplete validates your completions by checking if they start with the prefix given to the completer. You
|
|
244
|
-
can override this validation check by supplying the ``validator`` keyword to ``argcomplete.autocomplete()``:
|
|
245
|
-
|
|
246
|
-
.. code-block:: python
|
|
247
|
-
|
|
248
|
-
def my_validator(completion_candidate, current_input):
|
|
249
|
-
"""Complete non-prefix substring matches."""
|
|
250
|
-
return current_input in completion_candidate
|
|
251
|
-
|
|
252
|
-
argcomplete.autocomplete(parser, validator=my_validator)
|
|
253
|
-
|
|
254
|
-
Global completion
|
|
255
|
-
-----------------
|
|
256
|
-
In global completion mode, you don't have to register each argcomplete-capable executable separately. Instead, the shell
|
|
257
|
-
will look for the string **PYTHON_ARGCOMPLETE_OK** in the first 1024 bytes of any executable that it's running
|
|
258
|
-
completion for, and if it's found, follow the rest of the argcomplete protocol as described above.
|
|
259
|
-
|
|
260
|
-
Additionally, completion is activated for scripts run as ``python <script>`` and ``python -m <module>``. If you're using
|
|
261
|
-
multiple Python versions on the same system, the version being used to run the script must have argcomplete installed.
|
|
262
|
-
|
|
263
|
-
.. admonition:: Bash version compatibility
|
|
264
|
-
|
|
265
|
-
When using bash, global completion requires bash support for ``complete -D``, which was introduced in bash 4.2. Since
|
|
266
|
-
Mac OS ships with an outdated version of Bash (3.2), you can either use zsh or install a newer version of bash using
|
|
267
|
-
`Homebrew <http://brew.sh/>`_ (``brew install bash`` - you will also need to add ``/opt/homebrew/bin/bash`` to
|
|
268
|
-
``/etc/shells``, and run ``chsh`` to change your shell). You can check the version of the running copy of bash with
|
|
269
|
-
``echo $BASH_VERSION``.
|
|
270
|
-
|
|
271
|
-
.. note:: If you use setuptools/distribute ``scripts`` or ``entry_points`` directives to package your module,
|
|
272
|
-
argcomplete will follow the wrapper scripts to their destination and look for ``PYTHON_ARGCOMPLETE_OK`` in the
|
|
273
|
-
destination code.
|
|
274
|
-
|
|
275
|
-
If you choose not to use global completion, or ship a completion module that depends on argcomplete, you must register
|
|
276
|
-
your script explicitly using ``eval "$(register-python-argcomplete my-python-app)"``. Standard completion module
|
|
277
|
-
registration rules apply: namely, the script name is passed directly to ``complete``, meaning it is only tab completed
|
|
278
|
-
when invoked exactly as it was registered. In the above example, ``my-python-app`` must be on the path, and the user
|
|
279
|
-
must be attempting to complete it by that name. The above line alone would **not** allow you to complete
|
|
280
|
-
``./my-python-app``, or ``/path/to/my-python-app``.
|
|
281
|
-
|
|
282
|
-
Activating global completion
|
|
283
|
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
284
|
-
The script ``activate-global-python-argcomplete`` installs the global completion script
|
|
285
|
-
`bash_completion.d/_python-argcomplete <https://github.com/kislyuk/argcomplete/blob/master/argcomplete/bash_completion.d/_python-argcomplete>`_
|
|
286
|
-
into an appropriate location on your system for both bash and zsh. The specific location depends on your platform and
|
|
287
|
-
whether you installed argcomplete system-wide using ``sudo`` or locally (into your user's home directory).
|
|
288
|
-
|
|
289
|
-
Zsh Support
|
|
290
|
-
-----------
|
|
291
|
-
Argcomplete supports zsh. On top of plain completions like in bash, zsh allows you to see argparse help strings as
|
|
292
|
-
completion descriptions. All shellcode included with argcomplete is compatible with both bash and zsh, so the same
|
|
293
|
-
completer commands ``activate-global-python-argcomplete`` and ``eval "$(register-python-argcomplete my-python-app)"``
|
|
294
|
-
work for zsh as well.
|
|
295
|
-
|
|
296
|
-
Python Support
|
|
297
|
-
--------------
|
|
298
|
-
Argcomplete requires Python 3.7+.
|
|
299
|
-
|
|
300
|
-
Support for other shells
|
|
301
|
-
------------------------
|
|
302
|
-
Argcomplete maintainers provide support only for the bash and zsh shells on Linux and MacOS. For resources related to
|
|
303
|
-
other shells and platforms, including fish, tcsh, xonsh, powershell, and Windows, please see the
|
|
304
|
-
`contrib <https://github.com/kislyuk/argcomplete/tree/develop/contrib>`_ directory.
|
|
305
|
-
|
|
306
|
-
Common Problems
|
|
307
|
-
---------------
|
|
308
|
-
If global completion is not completing your script, bash may have registered a default completion function::
|
|
309
|
-
|
|
310
|
-
$ complete | grep my-python-app
|
|
311
|
-
complete -F _minimal my-python-app
|
|
312
|
-
|
|
313
|
-
You can fix this by restarting your shell, or by running ``complete -r my-python-app``.
|
|
314
|
-
|
|
315
|
-
Debugging
|
|
316
|
-
---------
|
|
317
|
-
Set the ``_ARC_DEBUG`` variable in your shell to enable verbose debug output every time argcomplete runs. This will
|
|
318
|
-
disrupt the command line composition state of your terminal, but make it possible to see the internal state of the
|
|
319
|
-
completer if it encounters problems.
|
|
320
|
-
|
|
321
|
-
Acknowledgments
|
|
322
|
-
---------------
|
|
323
|
-
Inspired and informed by the optcomplete_ module by Martin Blais.
|
|
324
|
-
|
|
325
|
-
.. _optcomplete: http://pypi.python.org/pypi/optcomplete
|
|
326
|
-
|
|
327
|
-
Links
|
|
328
|
-
-----
|
|
329
|
-
* `Project home page (GitHub) <https://github.com/kislyuk/argcomplete>`_
|
|
330
|
-
* `Documentation <https://kislyuk.github.io/argcomplete/>`_
|
|
331
|
-
* `Package distribution (PyPI) <https://pypi.python.org/pypi/argcomplete>`_
|
|
332
|
-
* `Change log <https://github.com/kislyuk/argcomplete/blob/master/Changes.rst>`_
|
|
333
|
-
|
|
334
|
-
Bugs
|
|
335
|
-
~~~~
|
|
336
|
-
Please report bugs, issues, feature requests, etc. on `GitHub <https://github.com/kislyuk/argcomplete/issues>`_.
|
|
337
|
-
|
|
338
|
-
License
|
|
339
|
-
-------
|
|
340
|
-
Copyright 2012-2023, Andrey Kislyuk and argcomplete contributors. Licensed under the terms of the
|
|
341
|
-
`Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`_. Distribution of the LICENSE and NOTICE
|
|
342
|
-
files with source copies of this package and derivative works is **REQUIRED** as specified by the Apache License.
|
|
343
|
-
|
|
344
|
-
.. image:: https://github.com/kislyuk/argcomplete/workflows/Python%20package/badge.svg
|
|
345
|
-
:target: https://github.com/kislyuk/argcomplete/actions
|
|
346
|
-
.. image:: https://codecov.io/github/kislyuk/argcomplete/coverage.svg?branch=master
|
|
347
|
-
:target: https://codecov.io/github/kislyuk/argcomplete?branch=master
|
|
348
|
-
.. image:: https://img.shields.io/pypi/v/argcomplete.svg
|
|
349
|
-
:target: https://pypi.python.org/pypi/argcomplete
|
|
350
|
-
.. image:: https://img.shields.io/pypi/l/argcomplete.svg
|
|
351
|
-
:target: https://pypi.python.org/pypi/argcomplete
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
.gitignore
|
|
2
|
-
Authors.rst
|
|
3
|
-
Changes.rst
|
|
4
|
-
LICENSE.rst
|
|
5
|
-
MANIFEST.in
|
|
6
|
-
Makefile
|
|
7
|
-
NOTICE
|
|
8
|
-
README.rst
|
|
9
|
-
SECURITY.md
|
|
10
|
-
common.mk
|
|
11
|
-
pyproject.toml
|
|
12
|
-
setup.cfg
|
|
13
|
-
setup.py
|
|
14
|
-
.github/FUNDING.yml
|
|
15
|
-
.github/workflows/ci.yml
|
|
16
|
-
argcomplete/__init__.py
|
|
17
|
-
argcomplete/_check_console_script.py
|
|
18
|
-
argcomplete/_check_module.py
|
|
19
|
-
argcomplete/completers.py
|
|
20
|
-
argcomplete/exceptions.py
|
|
21
|
-
argcomplete/finders.py
|
|
22
|
-
argcomplete/io.py
|
|
23
|
-
argcomplete/lexers.py
|
|
24
|
-
argcomplete/py.typed
|
|
25
|
-
argcomplete/shell_integration.py
|
|
26
|
-
argcomplete.egg-info/PKG-INFO
|
|
27
|
-
argcomplete.egg-info/SOURCES.txt
|
|
28
|
-
argcomplete.egg-info/dependency_links.txt
|
|
29
|
-
argcomplete.egg-info/entry_points.txt
|
|
30
|
-
argcomplete.egg-info/not-zip-safe
|
|
31
|
-
argcomplete.egg-info/requires.txt
|
|
32
|
-
argcomplete.egg-info/top_level.txt
|
|
33
|
-
argcomplete/bash_completion.d/_python-argcomplete
|
|
34
|
-
argcomplete/packages/__init__.py
|
|
35
|
-
argcomplete/packages/_argparse.py
|
|
36
|
-
argcomplete/packages/_shlex.py
|
|
37
|
-
argcomplete/scripts/__init__.py
|
|
38
|
-
argcomplete/scripts/activate_global_python_argcomplete.py
|
|
39
|
-
argcomplete/scripts/python_argcomplete_check_easy_install_script.py
|
|
40
|
-
argcomplete/scripts/register_python_argcomplete.py
|
|
41
|
-
contrib/README.rst
|
|
42
|
-
docs/changelog.rst
|
|
43
|
-
docs/conf.py
|
|
44
|
-
docs/fish_help_string.png
|
|
45
|
-
docs/index.rst
|
|
46
|
-
docs/toc.html
|
|
47
|
-
docs/examples/describe_github_user.py
|
|
48
|
-
test/__init__.py
|
|
49
|
-
test/inputrc
|
|
50
|
-
test/prog
|
|
51
|
-
test/stuck
|
|
52
|
-
test/test.py
|
|
53
|
-
test/test_contrib_shells.py
|
|
54
|
-
test/test_package/__init__.py
|
|
55
|
-
test/test_package/setup.py
|
|
56
|
-
test/test_package/test_module.py
|
|
57
|
-
test/test_package/build/lib/test_module.py
|
|
58
|
-
test/test_package/build/lib/test_package/__init__.py
|
|
59
|
-
test/test_package/test_package/__init__.py
|
|
60
|
-
test/test_package/test_package.egg-info/PKG-INFO
|
|
61
|
-
test/test_package/test_package.egg-info/SOURCES.txt
|
|
62
|
-
test/test_package/test_package.egg-info/dependency_links.txt
|
|
63
|
-
test/test_package/test_package.egg-info/entry_points.txt
|
|
64
|
-
test/test_package/test_package.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
[console_scripts]
|
|
2
|
-
activate-global-python-argcomplete = argcomplete.scripts.activate_global_python_argcomplete:main
|
|
3
|
-
python-argcomplete-check-easy-install-script = argcomplete.scripts.python_argcomplete_check_easy_install_script:main
|
|
4
|
-
register-python-argcomplete = argcomplete.scripts.register_python_argcomplete:main
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
argcomplete
|
argcomplete-3.5.2/setup.cfg
DELETED
argcomplete-3.5.2/setup.py
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
from setuptools import find_packages, setup
|
|
4
|
-
|
|
5
|
-
setup(
|
|
6
|
-
url="https://github.com/kislyuk/argcomplete",
|
|
7
|
-
packages=find_packages(exclude=["test", "test.*"]),
|
|
8
|
-
package_data={"argcomplete": ["bash_completion.d/_python-argcomplete", "py.typed"]},
|
|
9
|
-
zip_safe=False,
|
|
10
|
-
include_package_data=True,
|
|
11
|
-
platforms=["MacOS X", "Posix"],
|
|
12
|
-
)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# PYTHON_ARGCOMPLETE_OK
|
|
2
|
-
import argparse
|
|
3
|
-
|
|
4
|
-
import argcomplete
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def main():
|
|
8
|
-
parser = argparse.ArgumentParser()
|
|
9
|
-
parser.add_argument("arg", choices=["arg"])
|
|
10
|
-
argcomplete.autocomplete(parser)
|
|
11
|
-
args = parser.parse_args()
|
|
12
|
-
print(args.arg)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if __name__ == "__main__":
|
|
16
|
-
main()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argcomplete-3.5.2 → argcomplete-3.6.0}/argcomplete/scripts/activate_global_python_argcomplete.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{argcomplete-3.5.2/test/test_package/build/lib → argcomplete-3.6.0/test/test_package}/test_module.py
RENAMED
|
File without changes
|
|
File without changes
|