fix generate-* subcommands from other directories
This commit is contained in:
parent
7a9a39f2fb
commit
67cb69000b
1 changed files with 4 additions and 2 deletions
|
@ -50,7 +50,8 @@ def main() -> None:
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
elif args.subcommand == "generate-units":
|
elif args.subcommand == "generate-units":
|
||||||
if not args.force and os.path.isfile(args.directory + "/units.yaml"):
|
os.chdir(args.directory)
|
||||||
|
if not args.force and os.path.isfile("units.yaml"):
|
||||||
print(
|
print(
|
||||||
"units.yaml already exists, pass --force if you want to overwrite it",
|
"units.yaml already exists, pass --force if you want to overwrite it",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
|
@ -59,7 +60,8 @@ def main() -> None:
|
||||||
else:
|
else:
|
||||||
builder.generate_units()
|
builder.generate_units()
|
||||||
elif args.subcommand == "generate-ingredients":
|
elif args.subcommand == "generate-ingredients":
|
||||||
if not args.force and os.path.isfile(args.directory + "/ingredients.yaml"):
|
os.chdir(args.directory)
|
||||||
|
if not args.force and os.path.isfile("ingredients.yaml"):
|
||||||
print(
|
print(
|
||||||
"ingredients.yaml already exists, pass --force if you want to overwrite it",
|
"ingredients.yaml already exists, pass --force if you want to overwrite it",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue