Discover Packages
github.com/homburg/envoke
command
module
Version:
v0.0.0-...-c3c1118
Opens a new window with list of versions in this module.
Published: Sep 11, 2014
License: MIT
Opens a new window with license information.
Imports: 11
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
Envoke
envoke is for templating a file from environment variables with whatever delimiters you could want.
Template syntax
envoke uses Go's text/template package for templating.
All environment variables are converted to template "functions", ie. {{ API_KEY }}
Usage
# somefile.go.src
$ echo "
somefile.go.src
package main
const API_KEY = {{ API_KEY }}
func main () {
}" > somefile.go.src
# envoke!
$ API_KEY=xkembiy envoke somefile.go.src > somefile.go
# Use your own delimiters:
# somefile.html.src
$ echo "<html>
<head>
<script type="text/javascript">
window.API_KEY = [[ API_KEY ]];
</script>
</head>
<body>
<h1>{{ hello }} angular!</h1>
</body>
</html>" > somefile.html
$ API_KEY=seeeecret envoke "[[" "]]" somefile.html.src > somefile.html
# Fail on missing variables
$ envoke "[[" "]]" somefile.html || echo 'Nope!'
# ->
# Nope!
# or not
$ envoke -f "[[" "]]" somefile.html || echo 'Nope!'
# ->
# <head>
# ...
# Envoke from stdin
$ cat "Go {{ HOME }}" | envoke
TODO
Stdin
Non-strict/force mode
Test for
Fail on strict mode
Help message
Expand ▾
Collapse ▴
Documentation
¶
Envoke
Fill template from environment variable
Usage:
# Fill with default template syntax and print to stdout
envoke template.file
# Fill with alternative delimiters and print to stdout
envoke '<<' '>>' template.file
# Fill template from stdin
envoke
# Fill template from stdin
envoke -
# Fill with alternative template delimiters from stdin
envoke '<<' '>>' -
envoke '<<' '>>'
Source Files
¶
Click to show internal directories.
Click to hide internal directories.