We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f1ce670 commit 4a6d931Copy full SHA for 4a6d931
1 file changed
pythoncms/cli.py
@@ -44,11 +44,19 @@ def start(name, run):
44
try:
45
current_dir = Path.cwd()
46
except FileNotFoundError:
47
- click.echo("Error: The current working directory does not exist. Please change to a valid directory.")
48
- return
+ # Self-healing: if directory was deleted and recreated, try to recover from PWD env
+ pwd = os.environ.get("PWD")
49
+ if pwd and os.path.exists(pwd):
50
+ current_dir = Path(pwd)
51
+ else:
52
+ click.echo(
53
+ "Error: Your current directory has been deleted. Please 'cd' out and back in."
54
+ )
55
+ return
56
57
dest = os.path.join(str(current_dir), name)
58
59
+
60
if os.path.exists(dest):
61
click.echo(f"Error: Directory {name} already exists.")
62
return
0 commit comments