ability to list drafts

This commit is contained in:
me 2024-01-13 04:44:11 +01:00
parent 0ec4537d96
commit 4962f71d35

4
hgh.py
View file

@ -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("-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("--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("--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): def get_config(filename):
with open(filename, "r") as config_file: 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"): for file in glob.glob(config["settings"]["template_path"] + "*.jinja"):
print("- \"{}\"".format(file.lstrip(config["settings"]["template_path"]).rstrip(".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: if args.time:
#get_datetime() #get_datetime()
os.system("date +'%Y-%m-%dT%H:%M:%S%:z' | xsel -i -b") # geht bei mir leider nicht mit pyperclip3 os.system("date +'%Y-%m-%dT%H:%M:%S%:z' | xsel -i -b") # geht bei mir leider nicht mit pyperclip3