Allow skipping hidden and sorting

This commit is contained in:
Luke Murphy 2019-09-20 16:47:04 +02:00
parent 63902c079a
commit 2a0834734f
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
3 changed files with 17 additions and 0 deletions

View File

@ -2,6 +2,11 @@
The changelog was only added at version 0.0.4.
## 0.0.8
* Allow to ignore hidden directories with `--no-hidden`
* Files and directories are now sorted during distribusification.
## 0.0.7
Let's think a bit about safety and robustness:

View File

@ -72,6 +72,11 @@ def build_argparser():
help="Force whether distribusi overwrites or removes instances of index.html not generated by distribusi, use at own risk!",
action="store_true")
parser.add_argument(
'--no-hidden',
help="Exclude hidden directories",
action="store_true")
return parser

View File

@ -110,6 +110,13 @@ def distribusify(args, directory): # noqa
print('Excluding directory:', ", ".join(args.exclude_directory))
dirs[:] = [d for d in dirs if d not in args.exclude_directory]
if args.no_hidden:
dirs = list(filter(lambda d: not d.startswith('.'), dirs))
files = list(filter(lambda f: not f.startswith('.'), files))
dirs.sort()
files.sort()
if not args.remove_index:
html = []