Skip to content

Commit

Permalink
update-template: add --verbose, --all-posts options
Browse files Browse the repository at this point in the history
  • Loading branch information
acdha committed Nov 8, 2013
1 parent 6d6745a commit 4e6f50c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion bin/update-template
Expand Up @@ -109,9 +109,13 @@ def update_template(template_file, filename, site, blog_posts=None):

tidy(filename)


if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Apply a template to an HTML file')
parser.add_argument('files', metavar="HTML", nargs="*")
parser.add_argument('--verbose', '-v', default=False, action="store_true")
parser.add_argument('--all-posts', default=False, action="store_true",
help='Update all blog posts')
parser.add_argument('--template', default="_templates/post.html",
help='Template filename (default: %(default)s)')
args = parser.parse_args()
Expand All @@ -122,5 +126,12 @@ if __name__ == "__main__":
site = load_site()
blog_posts = site.pages.get_blog_posts()

for f in args.files:
if not args.all_posts:
files = args.files
else:
files = [i.filename for i in blog_posts]

for f in files:
if args.verbose:
print(f)
update_template(args.template, f, site, blog_posts=blog_posts)

0 comments on commit 4e6f50c

Please sign in to comment.