1313- To get your project version, run ``pythoncms --version``
1414- Run the sample command as ``pythoncms welcome [OPTIONS] NAME``
1515"""
16+ from pathlib import Path
17+
1618import click
19+ from shopyo .api .file import trycopytree
20+ from shopyo .api .file import trymkfile
21+ from shopyo .api .file import tryrmfile
22+ from shopyo .api .file import tryrmtree
1723
1824from pythoncms import __version__
1925
26+ path = Path (__file__ )
27+ import os
28+
2029
2130@click .group ()
2231@click .version_option (__version__ )
@@ -26,15 +35,34 @@ def cli(ctx):
2635 pass
2736
2837
29- @cli .command ("welcome" )
30- @click .argument ("name" )
31- @click .option ("--verbose" , "-v" , is_flag = True , default = False )
32- def welcome (name , verbose ):
33- """Sample command to welcome users.
38+ # @cli.command("welcome")
39+ # @click.argument("name")
40+ # @click.option("--verbose", "-v", is_flag=True, default=False)
41+ # def welcome(name, verbose):
42+ # """Sample command to welcome users.
43+
44+ # NAME will be printed along with the welcome message
45+ # """
46+ # click.secho(f"Hi {name}. Welcome to pythoncms", fg="cyan")
47+
48+ # if verbose:
49+ # click.echo("See you soon")
3450
35- NAME will be printed along with the welcome message
51+ reqs = f"""pythoncms=={ __version__ } """
52+
53+
54+ @cli .command ("start" )
55+ @click .argument ("name" )
56+ def start (name ):
57+ """
58+ New project
3659 """
37- click . secho ( f"Hi { name } . Welcome to pythoncms" , fg = "cyan" )
60+ dest = os . getcwd () + f"/ { name } "
3861
39- if verbose :
40- click .echo ("See you soon" )
62+ trycopytree (str (path .parent .absolute ()), dest )
63+ tryrmtree (dest + "/__pycache__" )
64+ tryrmtree (dest + "/migrations" )
65+ tryrmtree (dest + "/instance" )
66+ tryrmfile (dest + "/config.json" )
67+ trymkfile (dest + "/requirements.txt" , reqs )
68+ click .echo (f"🍭 Pythoncms project { name } is ready to go!" )
0 commit comments