mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Black
This commit is contained in:
@@ -8,19 +8,22 @@ import homeassistant.config as config_util
|
||||
|
||||
# mypy: allow-untyped-calls, allow-untyped-defs
|
||||
|
||||
|
||||
def run(args):
|
||||
"""Handle ensure config commandline script."""
|
||||
parser = argparse.ArgumentParser(
|
||||
description=("Ensure a Home Assistant config exists, "
|
||||
"creates one if necessary."))
|
||||
description=(
|
||||
"Ensure a Home Assistant config exists, " "creates one if necessary."
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
'-c', '--config',
|
||||
metavar='path_to_config_dir',
|
||||
"-c",
|
||||
"--config",
|
||||
metavar="path_to_config_dir",
|
||||
default=config_util.get_default_config_dir(),
|
||||
help="Directory that contains the Home Assistant configuration")
|
||||
parser.add_argument(
|
||||
'--script',
|
||||
choices=['ensure_config'])
|
||||
help="Directory that contains the Home Assistant configuration",
|
||||
)
|
||||
parser.add_argument("--script", choices=["ensure_config"])
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -28,12 +31,12 @@ def run(args):
|
||||
|
||||
# Test if configuration directory exists
|
||||
if not os.path.isdir(config_dir):
|
||||
print('Creating directory', config_dir)
|
||||
print("Creating directory", config_dir)
|
||||
os.makedirs(config_dir)
|
||||
|
||||
hass = HomeAssistant()
|
||||
config_path = hass.loop.run_until_complete(async_run(hass, config_dir))
|
||||
print('Configuration file:', config_path)
|
||||
print("Configuration file:", config_path)
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user