Skip to content

Commit

Permalink
Accept root option as environment variable
Browse files Browse the repository at this point in the history
--root option can also be read from FLASK_SEEDER_ROOT environment variable
  • Loading branch information
diddi- committed Apr 20, 2019
1 parent 711daf3 commit b73bae5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions flask_seeder/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ def seed():
""" Database seed commands """

@seed.command("run")
@click.option("--root", default="seeds", type=click.Path(), help="Root directory for seed scripts")
@click.option("--root", default="seeds", type=click.Path(),
help="Root directory for seed scripts",
envvar="FLASK_SEEDER_ROOT")
@click.argument("seeders", nargs=-1)
@with_appcontext
def seed_run(root, seeders):
Expand Down Expand Up @@ -163,7 +165,9 @@ def seed_run(root, seeders):


@seed.command("list")
@click.option("--root", default="seeds", type=click.Path(), help="Root directory for seed scripts")
@click.option("--root", default="seeds", type=click.Path(),
help="Root directory for seed scripts",
envvar="FLASK_SEEDER_ROOT")
def seed_list(root):
""" List all discoverable seeders """
for seeder in get_seeders(root=root):
Expand Down

0 comments on commit b73bae5

Please sign in to comment.