MTReload / vargen

Generate .go files with variables from files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vargen - generate variables from files

Installation:

go install github.com/mtreload/VariablesGenerator/cmd/vargen

Usage:

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

Capabilities

  • Generates string variable from file

Supported languages

  • Golang

Examples

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\""

)

TODOs

  • Try on linux
  • Generate multiple input files into one output file
  • Support more languages
  • Refactor code

About

Generate .go files with variables from files


Languages

Language:Go 100.0%