Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tom Bombadil
committed
Oct 10, 2012
1 parent
64663d4
commit e725f03
Showing
4 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
function template { | ||
_poop_name="$1"; shift | ||
_poop_resource="template" | ||
} | ||
|
||
function do_template { | ||
: ${_poop_action:=create} | ||
: ${_poop_path:=${_poop_name}} | ||
|
||
eval "do_${_poop_resource}_${_poop_action}" | ||
} | ||
|
||
function do_template_create { | ||
local _dollar='$' | ||
local pth_source="${_poop_sauce}" | ||
|
||
eval "cat <<EOF | ||
$(cat "${pth_source}" | perl -pe 's{\$\{(\w+)\}}{!!!/$1/!!!}g; | ||
s{\$}{\${_dollar}}g; | ||
s{!!!/(\w+)/!!!}{\${$1}}g;') | ||
EOF" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,8 @@ end | |
directory "meh" | ||
action delete | ||
end | ||
|
||
name="David" | ||
template "hello.txt" | ||
sauce "templates/feh" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
hello, $${name} |