Add basic shell autocompletion using argcomplete (#5618)

This commit is contained in:
Patrick ZAJDA 2023-11-05 21:27:14 +01:00 committed by GitHub
parent 13994d9bd1
commit 4ef2e28496
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -1,3 +1,4 @@
# PYTHON_ARGCOMPLETE_OK
import argparse
import functools
import logging
@ -7,6 +8,8 @@ import sys
import time
from datetime import datetime
import argcomplete
from esphome import const, writer, yaml_util
import esphome.codegen as cg
from esphome.config import iter_components, read_config, strip_default_ids
@ -966,6 +969,7 @@ def parse_args(argv):
# Finally, run the new-style parser again with the possibly swapped arguments,
# and let it error out if the command is unparsable.
parser.set_defaults(deprecated_argv_suggestion=deprecated_argv_suggestion)
argcomplete.autocomplete(parser)
return parser.parse_args(arguments)

View file

@ -19,3 +19,6 @@ kconfiglib==13.7.1
# esp-idf >= 5.0 requires this
pyparsing >= 3.0
# For autocompletion
argcomplete>=2.0.0