Skip to content

Go Modeler is a small CLI and Library that brings the powerful features of the golang template into a simplified form.

License

Notifications You must be signed in to change notification settings

toolsascode/gomodeler

Repository files navigation

Go Modeler CLI and Library

Go Reference Dependabot Updates Testing Publishing Version

The objective of this project is to help those people who need a small software to carry out their template compilations easily and quickly. The version is available to be used as a small CLI or a library in golang. We use Golang's templating system to perform the main demands of the application.

In this project we also have a set of our own functions and the phenomenal arrangement of the Sprig project to help you with the maximum resources available by the communities.

How to install?

Go Install

go install github.com/toolsascode/gomodeler@latest

Via Github

curl -fLSs https://raw.githubusercontent.com/toolsascode/gomodeler/main/scripts/install.sh | bash

Or

curl -fLSs https://raw.githubusercontent.com/toolsascode/gomodeler/main/scripts/install.sh | sudo bash

Homebrew

brew install toolsascode/tap/gomodeler

Scoop

  1. Run PowerShell as an Administrator and:
  2. To add this bucket, run scoop bucket add gomodeler-scoop https://github.com/toolsascode/scoop-bucket.
  3. To install, do scoop install gomodeler.

*Soon we will be making it available through other installation sources.

How to use?

See full documentation at gomodeler.md

  1. Create a structure. Example:

    root/
        /templates/
            file1.json.gotmpl
            file2.yaml.gotmpl
            file3.md.gotmpl
            file4.html.gotmpl
        /envFile.yaml
    

    *An important point is the file format, it is not mandatory, it avoids the need to inform each name for the output.

    • Template file name format: {filename}.{extension to output}.{extension to template}
    • The following file will be generated automatically by the output: {filename}.{extension to output}
  2. Create templates using the following available resources:

    1. Go template
    2. GoModeler Funcs
    3. Sprig
  3. Create a variables file in Yaml or Json format. It is also possible to pass the variables directly to the CLI in the key=value format.

    • Example: envFile.yaml
  4. Run the command with the following options:

gomodeler -f root/envFile.yaml --template-path root/templates --output-path root/outputs
  1. Just check the root/outputs folder where all files will be generated.

Examples

In the examples folder, some examples and models of how to use the CLI are available.

For more options run the gomodeler --help command or use gomodeler [command] --help for more information about a command. See gomodeler.md

About

Go Modeler is a small CLI and Library that brings the powerful features of the golang template into a simplified form.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published