Преглед изворни кода

Add optional argument --name to pc init (#735)

Harish Chandran пре 2 година
родитељ
комит
a43a83ad24
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      pynecone/pc.py

+ 2 - 2
pynecone/pc.py

@@ -23,9 +23,9 @@ def version():
 
 
 
 
 @cli.command()
 @cli.command()
-def init():
+def init(name: str = typer.Option(None, help="Name of the app to be initialized.")):
     """Initialize a new Pynecone app in the current directory."""
     """Initialize a new Pynecone app in the current directory."""
-    app_name = prerequisites.get_default_app_name()
+    app_name = prerequisites.get_default_app_name() if name is None else name
 
 
     # Make sure they don't name the app "pynecone".
     # Make sure they don't name the app "pynecone".
     if app_name == constants.MODULE_NAME:
     if app_name == constants.MODULE_NAME: