go install github.com/mtreload/VariablesGenerator/cmd/vargen
vargen -i input_file -o output_file [-p package_name]
Usage of vargen:
-i string
path to input file
-o string
path to output file
-p string
name of package to put into file
Default is name of folder output file is stored
- Generates string variable from file
- Golang
vargen -i .\texts\a.txt -o .\generated\a.go
./texts/a.txt:
Hello world!
"This is some text"
./generated/a.go
//This file is generated by vargen. Please, do not modify it.
package generated
var (
A = "Hello world!\n\"This is some text\""
)
- Try on linux
- Generate multiple input files into one output file
- Support more languages
- Refactor code