Git Product home page Git Product logo

goet's Introduction

Goet 🖨️

GitHub Release Go Version License

single-executable template renderer, powered by go template, sprig.

Usage

single-executable template renderer, powered by go template, sprig.

Usage:
  goet [flags]

Flags:
  -t, --template string          specify template file, "-" or unset means stdin (default "-")
  -o, --output string            specify output file, unset means stdout
  -f, --values strings           specify values in initConfig JSON/TOML/YAML file or initConfig URL (can specify multiple)
  -J, --set-json stringArray     set JSON values on the command line (can specify multiple or separate values with commas: key1=jsonval1,key2=jsonval2)
  -s, --set stringArray          set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
  -S, --set-string stringArray   set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
  -F, --set-file stringArray     set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
  -h, --help                     help for goet
  -v, --version                  version for goet

Example

$ goet -s name=MuXiu1997 <<EOF
Hello {{ .name }}, you're currently in {{ env "PWD" }}
EOF

# output:
Hello MuXiu1997, you're currently in /Users/muxiu1997/Projects/goet

Installation

Prebuilt Binaries

release page

Docker

docker run --rm muxiu1997/goet -h

Template Functions

Sprig

Template

  • templateFilePath - templateFilePath returns the path of the template file. If the template is stdin, "/dev/stdin" is returned. If the template is a URL, the URL is returned.
  • templateDirPath - templateDirPath returns the directory of the template file. If the template is stdin, "/dev" is returned. If the template is a URL, "" is returned.
  • outputFilePath - outputFilePath returns the path of the output file. If the output is stdout, "/dev/stdout" is returned.
  • outputDirPath - outputDirPath returns the directory of the output file. If the output is stdout, "/dev" is returned.

OS / FS / PATH

  • lookPath - lookPath runs exec.LookPath on name and returns the path or an empty string if the name is not found.
  • lstat - lstat runs os.Lstat on name and returns structured data that contains the fields name, size, mode, perm, modTime, isDir, and type if name exists.
  • readFile - readFile runs os.ReadFile on name and returns the contents.
  • cmdOutput - cmdOutput runs exec.Command on name and args and returns the output.
  • glob - glob runs filepath.Glob on pattern and returns the matches.
  • joinPath - joinPath runs filepath.Join on elements and returns the joined path with the OS-specific path separator.

YAML

  • fromYaml - fromYaml decodes YAML into a structured value, ignoring errors.
  • mustFromYaml - mustFromYaml decodes YAML into a structured value, returning errors.
  • toYaml - toYaml encodes an item into a YAML string, ignoring errors.
  • mustToYaml - mustToYaml encodes an item into a YAML string, returning errors.

TOML

  • fromToml - fromToml decodes TOML into a structured value, ignoring errors.
  • mustFromToml - mustFromToml decodes TOML into a structured value, returning errors.
  • toToml - toToml encodes an item into a TOML string, ignoring errors.
  • mustToToml - mustToToml encodes an item into a TOML string, returning errors.

Related

License

MIT

goet's People

Contributors

github-actions[bot] avatar muxiu1997 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.