default directory is always the current one, dont print anything if not verbose

This commit is contained in:
rra 2019-09-12 18:46:11 +02:00
parent 28f8793613
commit fc19d536df

View File

@ -1,8 +1,7 @@
import argparse import argparse, os
from distribusi.distribusi import distribusify from distribusi.distribusi import distribusify
def build_argparser(): def build_argparser():
parser = argparse.ArgumentParser(""" parser = argparse.ArgumentParser("""
distbusi is a content management system for the web that produces static distbusi is a content management system for the web that produces static
@ -14,7 +13,7 @@ def build_argparser():
) )
parser.add_argument( parser.add_argument(
'-d', '--directory', help="Select which directory to distribute" '-d', '--directory', help="Select which directory to distribute", default="."
) )
parser.add_argument( parser.add_argument(
@ -42,32 +41,27 @@ def build_argparser():
parser.add_argument( parser.add_argument(
'-nf', '-nf',
'--no-filenames', '--no-filenames',
help="Don't include image file names", help="Don't add file names to listing",
action="store_true", action="store_true",
) )
parser.add_argument( parser.add_argument(
'-c', '-c',
'--captions', '--captions',
help="Print captions stored in exif metadata", help="Adds image captions based on EXIF metadata",
action="store_true", 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 return parser
def cli_entrypoint(): def cli_entrypoint():
parser = build_argparser() parser = build_argparser()
args = parser.parse_args() args = parser.parse_args()
directory = '.' distribusify(args, 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)