Skip to content
Snippets Groups Projects
Commit 9fb51cd7 authored by Grant Miller's avatar Grant Miller
Browse files

Revert "Add command to install completion script"

This reverts commit 50706e3e.
parent 112da4f3
No related branches found
No related tags found
No related merge requests found
......@@ -363,31 +363,3 @@ def bootimg_analyze(args):
for line in pmb.aportgen.device.generate_deviceinfo_fastboot_content(args, bootimg).split("\n"):
tmp_output += "\n" + line.lstrip()
logging.info(tmp_output)
def register_bash_completion(args):
try:
import argcomplete
except ImportError:
raise RuntimeError("Could not find argcomplete! You can install it "
"with 'pip3 install argcomplete'")
dest = os.path.abspath(os.path.expanduser(args.dest))
command = os.path.basename(sys.argv[0])
dest_file = os.path.join(dest, command)
if args.uninstall:
logging.info("Removing file {}".format(dest_file))
os.remove(dest_file)
try:
os.removedirs(dest)
except OSError:
pass
else:
if "shellcode" not in dir(argcomplete):
raise RuntimeError("Argcomplete must be >=1.9.4. You can update "
"with 'pip3 install --upgrade argcomplete'")
logging.info("Writing to {}".format(dest_file))
os.makedirs(dest, mode=0o755, exist_ok=True)
with open(dest_file, "w") as f:
f.write(argcomplete.shellcode(command))
logging.info("Success! Please close and re-open your terminal to "
"enable bash completion")
......@@ -478,16 +478,6 @@ def arguments():
help="force even if the file seems to be"
" invalid")
# Action: register_bash_completion
completion = sub.add_parser("register_bash_completion",
help="install bash completion script")
completion_default_dir = "~/.local/share/bash-completion/completions/"
completion.add_argument("--dest", default=completion_default_dir,
help="destination directory, default: {}".format(
completion_default_dir))
completion.add_argument("--uninstall", action="store_true",
help="remove bash completion script")
if argcomplete:
argcomplete.autocomplete(parser, always_complete_options="long")
......
......@@ -61,7 +61,7 @@ setup(
tests_require=['pytest'],
cmdclass={'test': PyTest},
extras_require={
'argcomplete': ["argcomplete>=1.9.4"],
'argcomplete': ["argcomplete"],
},
entry_points={
'console_scripts': [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment