Skip to content

Commit 73bc10c

Browse files
committed
Wire the argcomplete into volshell too
1 parent e89e776 commit 73bc10c

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

volatility3/cli/volshell/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
plugins,
2222
)
2323

24+
try:
25+
import argcomplete
26+
27+
HAS_ARGCOMPLETE = True
28+
except ImportError:
29+
HAS_ARGCOMPLETE = False
30+
31+
2432
# Make sure we log everything
2533

2634
rootlog = logging.getLogger()
@@ -276,6 +284,10 @@ def run(self):
276284
# Hand the plugin requirements over to the CLI (us) and let it construct the config tree
277285

278286
# Run the argparser
287+
if HAS_ARGCOMPLETE:
288+
# The autocompletion line must be after the partial_arg handling, so that it doesn't trip it
289+
# before all the plugins have been added
290+
argcomplete.autocomplete(parser)
279291
args = parser.parse_args()
280292

281293
vollog.log(

volshell.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env python3
2+
# PYTHON_ARGCOMPLETE_OK
23

34
# This file is Copyright 2019 Volatility Foundation and licensed under the Volatility Software License 1.0
45
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0

0 commit comments

Comments
 (0)