1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-01 10:52:19 +01:00

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
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