Skip to content

Commit 2db74c3

Browse files
committed
refactor admin.py
also remove create cmd, we only need init and create will be used for creating networks
1 parent 1294052 commit 2db74c3

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/warnet/admin.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import click
55
from rich import print as richprint
66

7+
from .constants import NETWORK_DIR
78
from .namespaces import copy_namespaces_defaults, namespaces
89
from .network import copy_network_defaults
910

@@ -17,22 +18,6 @@ def admin():
1718
admin.add_command(namespaces)
1819

1920

20-
@admin.command()
21-
@click.argument("directory", type=Path)
22-
def create(directory):
23-
"""Create a new warnet project in the specified directory"""
24-
if os.path.exists(directory):
25-
richprint(f"[red]Error: Directory {directory} already exists[/red]")
26-
return
27-
28-
copy_network_defaults(directory)
29-
copy_namespaces_defaults(directory)
30-
richprint(
31-
f"[green]Copied network and namespace example files to {directory / 'networks'}[/green]"
32-
)
33-
richprint(f"[green]Created warnet project structure in {directory}[/green]")
34-
35-
3621
@admin.command()
3722
def init():
3823
"""Initialize a warnet project in the current directory"""
@@ -45,6 +30,6 @@ def init():
4530
copy_network_defaults(Path(current_dir))
4631
copy_namespaces_defaults(Path(current_dir))
4732
richprint(
48-
f"[green]Copied network and namespace example files to {Path(current_dir) / 'networks'}[/green]"
33+
f"[green]Copied network and namespace example files to {Path(current_dir) / NETWORK_DIR.name}[/green]"
4934
)
5035
richprint(f"[green]Created warnet project structure in {current_dir}[/green]")

0 commit comments

Comments
 (0)