Skip to content

Instantly share code, notes, and snippets.

@mwhahaha
Created November 19, 2015 17:32
Show Gist options
  • Save mwhahaha/7cc52842e81b59d18908 to your computer and use it in GitHub Desktop.
Save mwhahaha/7cc52842e81b59d18908 to your computer and use it in GitHub Desktop.
#!/bin/bash
# This is a quick hack to try and extract variables from puppet file
# and prints out a doc string, only works if the parameters are only
# have 2 spaces in front
egrep '^ \$(.*)\s+=\s+(.*)$' file.pp | \
sed -e 's/^ \$\([a-zA-Z0-9_]*\).*= \(.*\)$/# [*\1*]=# Default value is \2/g' | \
tr "=" "\n"
@mwhahaha
Copy link
Author

egrep '  \$(.​*)\s+=\s+(.*​)$' firewall.pp  | sed -e 's/^  \$\([a-zA-Z0-9_]*\).​*= \(.*\)$/#  [*\1*​]=#    String. Port for \1=#    Default value is \2=#/g' | tr "=" "\n"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment