Skip to content

Commit a2da74f

Browse files
committed
Don't create a Workspace when using the init command
1 parent f90e7cc commit a2da74f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/faff_cli/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@
2323

2424
@cli.callback()
2525
def main(ctx: typer.Context):
26-
ctx.obj = Workspace()
26+
# Don't create workspace for init command - it doesn't need one
27+
if ctx.invoked_subcommand == "init":
28+
ctx.obj = None
29+
else:
30+
ctx.obj = Workspace()
2731

2832
@cli.command()
2933
def init(ctx: typer.Context,
@@ -33,8 +37,7 @@ def init(ctx: typer.Context,
3337
cli: faff init
3438
Initialise faff obj.
3539
"""
36-
ws: Workspace = ctx.obj
37-
40+
# init doesn't need a workspace - ctx.obj will be None
3841
target_dir = Path(target_dir_str)
3942
if not target_dir.exists():
4043
typer.echo(f"Target directory {target_dir} does not exist.")

0 commit comments

Comments
 (0)