Skip to content
This repository was archived by the owner on Mar 13, 2024. It is now read-only.

Commit b7c250d

Browse files
committed
check for valid dir before valid package name
1 parent 257b968 commit b7c250d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dls_python3_skeleton/__main__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,15 @@ def validate_package(args) -> str:
129129

130130
def new(args):
131131
path: Path = args.path
132-
package = validate_package(args)
133132

134133
if path.exists():
135134
assert path.is_dir() and not list(
136135
path.iterdir()
137136
), f"Expected {path} to not exist, or be an empty dir"
138137
else:
139138
path.mkdir(parents=True)
139+
140+
package = validate_package(args)
140141
git("init", cwd=path)
141142
print(f"Created git repo in {path}")
142143
merge_skeleton(
@@ -150,9 +151,9 @@ def new(args):
150151

151152
def existing(args):
152153
path: Path = args.path
153-
package = validate_package(args)
154154

155155
assert path.is_dir(), f"Expected {path} to be an existing directory"
156+
package = validate_package(args)
156157
conf = ConfigParser()
157158
conf.read(path / "setup.cfg")
158159
merge_skeleton(

0 commit comments

Comments
 (0)