mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 08:28:12 +01:00
Add basic shell autocompletion using argcomplete (#5618)
This commit is contained in:
parent
13994d9bd1
commit
4ef2e28496
2 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -19,3 +19,6 @@ kconfiglib==13.7.1
|
|||
|
||||
# esp-idf >= 5.0 requires this
|
||||
pyparsing >= 3.0
|
||||
|
||||
# For autocompletion
|
||||
argcomplete>=2.0.0
|
||||
|
|
Loading…
Reference in a new issue