From fc19d536df23b64c0e60fc9c665b8055872ec30b Mon Sep 17 00:00:00 2001 From: rra Date: Thu, 12 Sep 2019 18:46:11 +0200 Subject: [PATCH] default directory is always the current one, dont print anything if not verbose --- distribusi/cli.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/distribusi/cli.py b/distribusi/cli.py index 3913da0..7e0d51a 100644 --- a/distribusi/cli.py +++ b/distribusi/cli.py @@ -1,8 +1,7 @@ -import argparse +import argparse, os from distribusi.distribusi import distribusify - def build_argparser(): parser = argparse.ArgumentParser(""" distbusi is a content management system for the web that produces static @@ -14,7 +13,7 @@ def build_argparser(): ) parser.add_argument( - '-d', '--directory', help="Select which directory to distribute" + '-d', '--directory', help="Select which directory to distribute", default="." ) parser.add_argument( @@ -42,32 +41,27 @@ def build_argparser(): parser.add_argument( '-nf', '--no-filenames', - help="Don't include image file names", + help="Don't add file names to listing", action="store_true", ) parser.add_argument( '-c', '--captions', - help="Print captions stored in exif metadata", + help="Adds image captions based on EXIF metadata", action="store_true", ) + parser.add_argument( + '-r', + '--remove-index', + help="Removes previously made index.html. Warning: this will remove ALL index.html files in the directories listed", + action="store_true") + return parser def cli_entrypoint(): parser = build_argparser() - args = parser.parse_args() - directory = '.' - - if args.directory: - if args.verbose: - print('Generating directory listing for', args.directory) - if args.thumbnail: - print('Making thumbnails') - directory = args.directory - else: - directory = '.' - - distribusify(args, directory) + args = parser.parse_args() + distribusify(args, args.directory)