예제 #1
0
def init(path):

    if path:
        os.chdir(path)

    current_dir = os.getcwd()
    config_path = os.path.join(current_dir, "config.json")

    if os.path.exists(config_path):
        print("These is a config.json in current directory(%s), " "Have you run `catsup init` before?" % current_dir)
        return

    posts_folder = prompt("posts folder", default="posts")

    deploy_folder = prompt("output folder", default="deploy")

    if not (posts_folder.startswith(".") or os.path.exists(posts_folder)):
        os.makedirs(posts_folder)

    default_config_path = os.path.join(g.public_templates_path, "config.json")
    template = open(default_config_path, "r").read()
    template = template.replace("posts", posts_folder)
    template = template.replace("deploy", deploy_folder)

    with open(config_path, "w") as f:
        f.write(template)

    print("catsup init success!")
    print("Plese edit the generated config.json to configure your blog. ")
예제 #2
0
 def add(name):
     """
     Usage:
         parguments add <name>
     """
     print(prompt(name='hello', default='whtsky'))
예제 #3
0
 def add(name):
     """
     Usage:
         parguments add <name>
     """
     print(prompt(name='hello'))