pystatsite

On-or-Offline static site generator in Python
Log | Files | Refs | README | LICENSE

commit 92703e3a7bc2070313f9be2c043c3ba4a50a2564
parent 07cb9e4b56137ac770e2af94fb1e9ff97332f912
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Mon, 29 Mar 2021 00:07:22 -0500

added more interfaces and universalized exit

Diffstat:
Mdata/interfaces.json | 26++++++++++++++++++++++++--
Mpystatsite.py | 6++----
2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/data/interfaces.json b/data/interfaces.json @@ -4,8 +4,30 @@ "choices" : [ ["Create a new web page", "new_page"], ["Edit an existing web page", "edit_page"], - ["Sync site to a location", "sync_site"], - ["Quit", "exit"] + ["Sync site to a location", "sync_site"] + ] + }, + "new_page" : { + "prompt" : "============\n| NEW PAGE |\n============\nPlease choose an option:", + "choices" : [ + ["Create a new blog post", "new_blog"], + ["Create a new top-level site page", "new_top_page"], + ["Create a new page at another site location", "new_hierarchy_page"] + ] + }, + "edit_page" : { + "prompt" : "=============\n| EDIT PAGE |\n=============\nPlease choose an option:", + "choices" : [ + ["Edit a blog post", "edit_blog"], + ["Edit a top-level site page", "edit_top_page"], + ["Edit a page at another site location", "edit_hierarchy_page"] + ] + }, + "sync_site" : { + "prompt" : "=============\n| SYNC SITE |\n=============\nPlease choose an option:", + "choices" : [ + ["Sync to a remote location", "sync_remote"], + ["Sync to a local directory", "sync_local"] ] } } diff --git a/pystatsite.py b/pystatsite.py @@ -8,6 +8,7 @@ def interface(interface_name = ""): chosen = False choice = None choices = loaded_interfaces[interface_name]["choices"] + choices.append(["Quit", "exit"]) while not chosen: os.system("clear") print(loaded_interfaces[interface_name]["prompt"]) @@ -45,8 +46,5 @@ funcs = { with open(options_file) as o: loaded_options = json.load(o) with open(interfaces_file) as i: loaded_interfaces = json.load(i) -def main(options = loaded_options): - interface("main") - if __name__ == "__main__": - main(loaded_options) + interface("main")