mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Support multiple configuration directories for update-all subcommand (#1925)
This commit is contained in:
parent
8c41fc2b1d
commit
d436409153
4 changed files with 18 additions and 14 deletions
|
@ -296,7 +296,6 @@ def command_vscode(args):
|
||||||
|
|
||||||
logging.disable(logging.INFO)
|
logging.disable(logging.INFO)
|
||||||
logging.disable(logging.WARNING)
|
logging.disable(logging.WARNING)
|
||||||
CORE.config_path = args.configuration
|
|
||||||
vscode.read_config(args)
|
vscode.read_config(args)
|
||||||
|
|
||||||
|
|
||||||
|
@ -406,7 +405,7 @@ def command_update_all(args):
|
||||||
import click
|
import click
|
||||||
|
|
||||||
success = {}
|
success = {}
|
||||||
files = list_yaml_files(args.configuration[0])
|
files = list_yaml_files(args.configuration)
|
||||||
twidth = 60
|
twidth = 60
|
||||||
|
|
||||||
def print_bar(middle_text):
|
def print_bar(middle_text):
|
||||||
|
@ -694,14 +693,12 @@ def parse_args(argv):
|
||||||
)
|
)
|
||||||
|
|
||||||
parser_vscode = subparsers.add_parser("vscode")
|
parser_vscode = subparsers.add_parser("vscode")
|
||||||
parser_vscode.add_argument(
|
parser_vscode.add_argument("configuration", help="Your YAML configuration file.")
|
||||||
"configuration", help="Your YAML configuration file.", nargs=1
|
|
||||||
)
|
|
||||||
parser_vscode.add_argument("--ace", action="store_true")
|
parser_vscode.add_argument("--ace", action="store_true")
|
||||||
|
|
||||||
parser_update = subparsers.add_parser("update-all")
|
parser_update = subparsers.add_parser("update-all")
|
||||||
parser_update.add_argument(
|
parser_update.add_argument(
|
||||||
"configuration", help="Your YAML configuration file directory.", nargs=1
|
"configuration", help="Your YAML configuration file directories.", nargs="+"
|
||||||
)
|
)
|
||||||
|
|
||||||
return parser.parse_args(argv[1:])
|
return parser.parse_args(argv[1:])
|
||||||
|
|
|
@ -98,7 +98,7 @@ class DashboardSettings:
|
||||||
return os.path.join(self.config_dir, *args)
|
return os.path.join(self.config_dir, *args)
|
||||||
|
|
||||||
def list_yaml_files(self):
|
def list_yaml_files(self):
|
||||||
return util.list_yaml_files(self.config_dir)
|
return util.list_yaml_files([self.config_dir])
|
||||||
|
|
||||||
|
|
||||||
settings = DashboardSettings()
|
settings = DashboardSettings()
|
||||||
|
|
|
@ -247,17 +247,24 @@ class OrderedDict(collections.OrderedDict):
|
||||||
return dict(self).__repr__()
|
return dict(self).__repr__()
|
||||||
|
|
||||||
|
|
||||||
def list_yaml_files(folder):
|
def list_yaml_files(folders):
|
||||||
files = filter_yaml_files([os.path.join(folder, p) for p in os.listdir(folder)])
|
files = filter_yaml_files(
|
||||||
|
[os.path.join(folder, p) for folder in folders for p in os.listdir(folder)]
|
||||||
|
)
|
||||||
files.sort()
|
files.sort()
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
||||||
def filter_yaml_files(files):
|
def filter_yaml_files(files):
|
||||||
files = [f for f in files if os.path.splitext(f)[1] == ".yaml"]
|
return [
|
||||||
files = [f for f in files if os.path.basename(f) != "secrets.yaml"]
|
f
|
||||||
files = [f for f in files if not os.path.basename(f).startswith(".")]
|
for f in files
|
||||||
return files
|
if (
|
||||||
|
os.path.splitext(f)[1] == ".yaml"
|
||||||
|
and os.path.basename(f) != "secrets.yaml"
|
||||||
|
and not os.path.basename(f).startswith(".")
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class SerialPort:
|
class SerialPort:
|
||||||
|
|
|
@ -67,7 +67,7 @@ def read_config(args):
|
||||||
CORE.ace = args.ace
|
CORE.ace = args.ace
|
||||||
f = data["file"]
|
f = data["file"]
|
||||||
if CORE.ace:
|
if CORE.ace:
|
||||||
CORE.config_path = os.path.join(args.configuration[0], f)
|
CORE.config_path = os.path.join(args.configuration, f)
|
||||||
else:
|
else:
|
||||||
CORE.config_path = data["file"]
|
CORE.config_path = data["file"]
|
||||||
vs = VSCodeResult()
|
vs = VSCodeResult()
|
||||||
|
|
Loading…
Reference in a new issue