Browse Source

Allow skipping hidden and sorting

master
Luke Murphy 5 years ago
parent
commit
2a0834734f
No known key found for this signature in database GPG Key ID: 5E2EF5A63E3718CC
  1. 5
      CHANGELOG.md
  2. 5
      distribusi/cli.py
  3. 7
      distribusi/distribusi.py

5
CHANGELOG.md

@ -2,6 +2,11 @@
The changelog was only added at version 0.0.4. 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 ## 0.0.7
Let's think a bit about safety and robustness: Let's think a bit about safety and robustness:

5
distribusi/cli.py

@ -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!", help="Force whether distribusi overwrites or removes instances of index.html not generated by distribusi, use at own risk!",
action="store_true") action="store_true")
parser.add_argument(
'--no-hidden',
help="Exclude hidden directories",
action="store_true")
return parser return parser

7
distribusi/distribusi.py

@ -110,6 +110,13 @@ def distribusify(args, directory): # noqa
print('Excluding directory:', ", ".join(args.exclude_directory)) print('Excluding directory:', ", ".join(args.exclude_directory))
dirs[:] = [d for d in dirs if d not in 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: if not args.remove_index:
html = [] html = []

Loading…
Cancel
Save