frep alternatives and similar packages
Based on the "Command Line" category.
Alternatively, view frep alternatives based on common mentions on social networks and blogs.
-
urfave/cli
A simple, fast, and fun package for building command line apps in Go -
Rich Interactive Widgets for Terminal UIs
Terminal UI library with rich, interactive widgets — written in Golang -
elvish
Elvish = Expressive Programming Language + Versatile Interactive Shell -
go-prompt
Building powerful interactive prompts in Go, inspired by python-prompt-toolkit. -
survey
A golang library for building interactive and accessible prompts with full support for windows and posix terminals. -
tcell
Tcell is an alternate terminal package, similar in some ways to termbox, but better in others. -
cointop
A fast and lightweight interactive terminal based UI application for tracking cryptocurrencies 🚀 -
pterm
✨ #PTerm is a modern Go module to easily beautify console output. Featuring charts, progressbars, tables, trees, text input, select menus and much more 🚀 It's completely configurable and 100% cross-platform compatible. -
progressbar
A really basic thread-safe progress bar for Golang applications -
The Platinum Searcher
A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings. -
pflag
Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags. -
readline
Readline is a pure go(golang) implementation for GNU-Readline kind library -
asciigraph
Go package to make lightweight ASCII line graph ╭┈╯ in command line apps with no other dependencies. -
Git Town
Git workflow automation to keep branches in sync and reduce merge conflicts. -
dotenv-linter
⚡️Lightning-fast linter for .env files. Written in Rust 🦀 -
CLI Color
🎨 Terminal color rendering library, support 8/16 colors, 256 colors, RGB color rendering output, support Print/Sprintf methods, compatible with Windows. GO CLI 控制台颜色渲染工具库,支持16色,256色,RGB色彩渲染输出,使用类似于 Print/Sprintf,兼容并支持 Windows 环境的色彩渲染 -
flaggy
Idiomatic Go input parsing with subcommands, positional values, and flags at any position. No required project or package layout and no external dependencies. -
uitable
A go library to improve readability in terminal apps using tabular data
Tired of breaking your main and manually rebasing outdated pull requests?
Do you think we are missing an alternative of frep or a related project?
Popular Comparisons
README
frep
Generate file using template from environment, arguments, json/yaml/toml config files.
NAME:
frep - Generate file using template
USAGE:
frep [options] input-file[:output-file] ...
VERSION:
1.3.x
AUTHORS:
Guoqiang Chen <[email protected]>
OPTIONS:
-e, --env name=value set variable name=value, can be passed multiple times
--json jsonstring load variables from json object string
--load file load variables from json/yaml/toml file
--no-sys-env exclude system environments, default false
--overwrite overwrite if destination file exists
--dryrun just output result to console instead of file
--strict exit on any error during template processing
--delims value template tag delimiters (default: {{:}})
--missing handling of missing vars, one of: default/invalid, zero, error (default: default)
--help print this usage
--version print version information
EXAMPLES:
frep nginx.conf.in -e webroot=/usr/share/nginx/html -e port=8080
frep nginx.conf.in:/etc/nginx.conf -e webroot=/usr/share/nginx/html -e port=8080
frep nginx.conf.in --json '{"webroot": "/usr/share/nginx/html", "port": 8080}'
frep nginx.conf.in --load config.json --overwrite
echo "{{ .Env.PATH }}" | frep -
Downloads
v1.3.12 Release: https://github.com/subchen/frep/releases/tag/v1.3.12
Linux
curl -fSL https://github.com/subchen/frep/releases/download/v1.3.12/frep-1.3.12-linux-amd64 -o /usr/local/bin/frep chmod +x /usr/local/bin/frep # centos / redhat yum install https://github.com/subchen/frep/releases/download/v1.3.12/frep-1.3.12-74.x86_64.rpm # ubuntu curl -fSL https://github.com/subchen/frep/releases/download/v1.3.12/frep_1.3.12-74_amd64.deb -o frep_1.3.12-74_amd64.deb dpkg -i frep_1.3.12-74_amd64.deb
macOS
brew install subchen/tap/frep
Windows
wget https://github.com/subchen/frep/releases/download/v1.3.12/frep-1.3.12-windows-amd64.exe
Docker
You can run frep using docker container
docker run -it --rm subchen/frep --help
Examples
Load template variables
Load from environment
export webroot=/usr/share/nginx/html export port=8080 frep nginx.conf.in
Load from arguments
frep nginx.conf.in -e webroot=/usr/share/nginx/html -e port=8080
Load from JSON String
frep nginx.conf.in --json '{"webroot": "/usr/share/nginx/html", "port": 8080}'
Load from JSON file
cat > config.json << EOF { "webroot": "/usr/share/nginx/html", "port": 8080, "servers": [ "127.0.0.1:8081", "127.0.0.1:8082" ] } EOF frep nginx.conf.in --load config.json
Load from YAML file
cat > config.yaml << EOF webroot: /usr/share/nginx/html port: 8080 servers: - 127.0.0.1:8081 - 127.0.0.1:8082 EOF frep nginx.conf.in --load config.yaml
Load from TOML file
cat > config.toml << EOF webroot = /usr/share/nginx/html port = 8080 servers = [ "127.0.0.1:8081", "127.0.0.1:8082" ] EOF frep nginx.conf.in --load config.toml
Input/Output
Input from file
// input file: nginx.conf frep nginx.conf.in
Input from console(stdin)
// input from stdin pipe echo "{{ .Env.PATH }}" | frep -
Output to default file (Removed last file ext)
// output file: nginx.conf frep nginx.conf.in --overwrite
Output to the specified file
// output file: /etc/nginx.conf frep nginx.conf.in:/etc/nginx.conf --overwrite -e port=8080
Output to console(stdout)
frep nginx.conf.in --dryrun frep nginx.conf.in:-
Output multiple files
frep nginx.conf.in redis.conf.in ...
Template
Templates use Golang text/template.
You can access environment variables within a template
Env.PATH = {{ .Env.PATH }}
If your template file uses {{
and }}
as part of it's syntax,
you can change the template escape characters using the --delims
.
frep --delims "<%:%>" ...
There are some built-in functions as well: Masterminds/sprig v2.22.0
More funcs added:
- toJson
- toYaml
- toToml
- toBool
- fileSize
- fileLastModified
- fileGetBytes
- fileGetString
- fileExists
- include
- countRune
- pipeline compatible regex functions from sprig
- reReplaceAll
- reReplaceAllLiteral
- reSplit
- awsSecret
- awsParameterStore
Sample of nginx.conf.in
server {
listen {{ .port }} default_server;
root {{ .webroot | default "/usr/share/nginx/html" }};
index index.html index.htm;
location /api {
{{ include "shared/log.nginx" | indent 8 | trim }}
proxy_pass http://backend;
}
}
upstream backend {
ip_hash;
{{- range .servers }}
server {{.}};
{{- end }}
}
Sample using secrets, first of all take into account that in order to use the secret functionality you need to have a proper AWS configuration in place and permissions enough to read secrets from AWS Secrets Manager. More details of how to configure AWSCLI can be found at https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
Once you have all the requirements just create a template like this one:
# application.conf
mysql_host: {{ .mysql_host }}
mysql_user: {{ .mysql_user }}
mysql_pass: {{ awsSecret "application/mysql/password" }}
In above example mysql_host
and mysql_user
will be filled as usual by using frep
config file or environment variables but mysql_pass
will be fetch straight from AWS Secrets Manager by looking at secret name application/mysql/password
If you have multiple items in a single secret you can retrieve an specific key by specifying the key you want in template, for example:
# application.conf
mysql_host: {{ .mysql_host }}
mysql_user: {{ .mysql_user }}
mysql_pass: {{ awsSecret "application/mysql/password" }}
external_api_client: {{ awsSecret "application/external_api" "client_id" }}
external_api_secret: {{ awsSecret "application/external_api" "secret_key" }}
Sample using AWS Parameter Store, first of all take into account that in order to use the ssm functionality you need to have a proper AWS configuration in place and permissions enough to read parameters from AWS Parameter Store. More details of how to configure AWSCLI can be found at https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html
Once you have all the requirements just create a template like this one:
# application.conf
mysql_host: {{ .mysql_host }}
mysql_user: {{ .mysql_user }}
mysql_pass: {{ awsSecret "application/mysql/password" }}
mysql_dns: {{ awsParameterStore "application/mysql/dns" }}
In above example mysql_dns
will be filled as usual by using frep
config file or environment variables but mysql_pass
will be fetch straight from AWS Parameter Store by looking at application/mysql/dns
SSM Limitation: You can get parameter from ParameterStore just in textplain.
*Note that all licence references and agreements mentioned in the frep README section above
are relevant to that project's source code only.