#!/usr/bin/python
"""
Renders a template to a collectd config.


Copyright 2015 Google Inc. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""

import jinja2
import os.path
import sys

env = jinja2.Environment(
    loader=jinja2.FileSystemLoader(os.path.dirname(sys.argv[0]) or "."),
    trim_blocks=True,
    lstrip_blocks=True,
    extensions=['jinja2.ext.do'])

print env.get_template(sys.argv[1]).render()

@@ -15,55 +15,11 @@
 hon%0A
-%22%22%22%0ARenders a template to a collectd config.%0A%0A%0A
+%0A# 
 Copy
@@ -62,17 +62,20 @@
 served.%0A
-%0A
+#%0A# 
 Licensed
@@ -130,16 +130,18 @@
 ense%22);%0A
+# 
 you may 
@@ -197,16 +197,18 @@
 icense.%0A
+# 
 You may 
@@ -239,21 +239,24 @@
 ense at%0A
-%0A
+#%0A#
     
+ 
 http://w
@@ -290,17 +290,20 @@
 NSE-2.0%0A
-%0A
+#%0A# 
 Unless r
@@ -362,16 +362,18 @@
 oftware%0A
+# 
 distribu
@@ -430,16 +430,18 @@
  BASIS,%0A
+# 
 WITHOUT 
@@ -505,16 +505,18 @@
 mplied.%0A
+# 
 See the 
@@ -575,16 +575,18 @@
 ons and%0A
+# 
 limitati
@@ -607,16 +607,196 @@
 License.
+%0A%0A%22%22%22%0ARenders a template to a collectd config.%0A%0AExample usage:%0A  cd etc/collectd.d; %5C%0A  for f in *.conf; do %5C%0A    python ../../templates/render_templates.py $f.jinja %3E $f; %5C%0A  done
 %0A%22%22%22%0A%0Aim

Add sample usage; move license to a comment. (#45)