From 0ec4537d96cd3e2d0495611ffe341b3c008b0e65 Mon Sep 17 00:00:00 2001 From: me <> Date: Tue, 9 Jan 2024 22:14:48 +0100 Subject: [PATCH 1/2] add -cd for -cdb --- hgh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hgh.py b/hgh.py index 946960b..fcd6cdb 100755 --- a/hgh.py +++ b/hgh.py @@ -18,7 +18,7 @@ group0.add_argument("--sites", help="Print all sites from from configuration", d group2.add_argument("--create-comments-file", help="Create a comments.json in current working directory with given amount of comments.", dest='create_comments_file', action="store_true") group2.add_argument("-cpb", "--create-pagebundle", help="Create new page bundle. Add --template for specific template to use.", dest='create_pagebundle', action="store", type=str, default = None) group2.add_argument("--time", help="Copy current date and time to clipboard.", dest='time', action="store_true") -group2.add_argument("-cdb", help="Change directory to base directory of site.", dest='cdb', action="store_true") +group2.add_argument("-cd", "-cdb", help="Change directory to base directory of site.", dest='cdb', action="store_true") group2.add_argument("-cdc", help="Change directory to contentdir of site.", dest='cdc', action="store_true") group2.add_argument("-cdl", help="Change directory to alternative contentdir of site.", dest='cdl', action="store_true") group2.add_argument("--build", help="Build a site.", dest='site_build', action="store_true") From 4962f71d357f8ddaab90b8fed14aa09e674b992c Mon Sep 17 00:00:00 2001 From: me <> Date: Sat, 13 Jan 2024 04:44:11 +0100 Subject: [PATCH 2/2] ability to list drafts --- hgh.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hgh.py b/hgh.py index fcd6cdb..445e6cd 100755 --- a/hgh.py +++ b/hgh.py @@ -37,6 +37,7 @@ group3.add_argument("-ft", "--find-tags", help="Find tags containing search term group3.add_argument("-fc", "--find-categories", help="Find categories containing search term. Strings and regex are allowed.", dest='find_categories', action="store", type=str, default = None) group3.add_argument("--template", help="Use template for --create-pagebundle command.", dest='template', action="store", type=str, default = None) group3.add_argument("--list-templates", help="List available templates.", dest='list_templates', action="store_true") +group3.add_argument("-ld", "--list-drafts", help="List all drafts of a site.", dest='list_drafts', action="store_true") def get_config(filename): with open(filename, "r") as config_file: @@ -251,6 +252,9 @@ if args.list_templates: for file in glob.glob(config["settings"]["template_path"] + "*.jinja"): print("- \"{}\"".format(file.lstrip(config["settings"]["template_path"]).rstrip(".jinja"))) +if args.list_drafts: + os.system("hugo list drafts | tail -n +2") + if args.time: #get_datetime() os.system("date +'%Y-%m-%dT%H:%M:%S%:z' | xsel -i -b") # geht bei mir leider nicht mit pyperclip3