def parse_args():
""" Parse the command line arguments """
parser = argparse.ArgumentParser(
description="Integrate Hugo and PhotoSwipe")
parser.add_argument('-v', '--verbose', help="Verbose mode",
action="store_const", dest="loglevel", const=logging.INFO,
default=logging.WARNING)
parser.add_argument('-f', '--fast', action="store_true", help=('Fast mode '
'(tries less potential crops)'))
parser.add_argument('command', choices=['new', 'update', 'clean', 'init'],
help="action to do")
parser.add_argument('album', nargs='?',
help="album to apply the action to")
args = parser.parse_args()
logging.basicConfig(level=args.loglevel, datefmt="[%Y-%m-%d %H:%M:%S]",
format="%(asctime)s - %(message)s")
settings.verbose = args.loglevel == logging.INFO
settings.fast = args.fast
return args.command, args.album
评论列表
文章目录