You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
67 lines
1.9 KiB
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
|
|
index pages based on folders in the files system. It is inspired by the
|
|
automatic index functions featured in several popular web servers. It works by
|
|
traversing the file system and directory hierarchy to automatically list
|
|
all the files in the directory, detect the file types and providing them with
|
|
relevant html classes and tags for easy styling."""
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-d', '--directory', help="Select which directory to distribute", default="."
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-s', '--style', help="Select a CSS style sheet to include"
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-v', '--verbose', help="Print verbose debug output", action="store_true"
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-t',
|
|
'--thumbnail',
|
|
help="Generate 450x450 thumbnails for images",
|
|
action="store_true",
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-n',
|
|
'--no-template',
|
|
help="Don't use the template to output html",
|
|
action="store_true",
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-nf',
|
|
'--no-filenames',
|
|
help="Don't add file names to listing",
|
|
action="store_true",
|
|
)
|
|
|
|
parser.add_argument(
|
|
'-c',
|
|
'--captions',
|
|
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()
|
|
distribusify(args, args.directory)
|
|
|