Skip to content

Commit

Permalink
export
Browse files Browse the repository at this point in the history
  • Loading branch information
Alw3ys committed Feb 6, 2024
1 parent 366e964 commit 9ae3a92
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions dosei/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from dosei import Dosei
from dosei.importer import import_from_string, ImportFromStringError

dosei_config_init = "dosei_config:dosei"

# Add current dir to PYTHONPATH
sys.path.insert(0, "")

Expand All @@ -21,7 +23,7 @@ def run(func):
if func:
return Dosei.call_func(import_from_string(func))
try:
app: Dosei = import_from_string("dosei_config:dosei")
app: Dosei = import_from_string(dosei_config_init)
except ImportFromStringError:
raise click.ClickException(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")
if app.command is None:
Expand All @@ -32,7 +34,7 @@ def run(func):
@cli.command()
def dev():
try:
app: Dosei = import_from_string("dosei_config:dosei")
app: Dosei = import_from_string(dosei_config_init)
except ImportFromStringError:
raise click.ClickException(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")
if app.dev is None:
Expand All @@ -41,7 +43,9 @@ def dev():


@cli.command()
@click.argument("app")
def export(app):
app: Dosei = import_from_string(app)
return app.export()
def export():
try:
app: Dosei = import_from_string(dosei_config_init)
return app.export()
except ImportFromStringError:
raise click.ClickException(f"Couldn't find a dosei_config.py file in \"{os.getcwd()}\"")

0 comments on commit 9ae3a92

Please sign in to comment.