https://github.com/guumaster/surveygen
generate interactive surveys from yaml files
https://github.com/guumaster/surveygen
Last synced: over 1 year ago
JSON representation
generate interactive surveys from yaml files
- Host: GitHub
- URL: https://github.com/guumaster/surveygen
- Owner: guumaster
- License: mit
- Created: 2020-03-16T08:45:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-16T11:09:16.000Z (over 6 years ago)
- Last Synced: 2025-03-18T20:07:58.402Z (over 1 year ago)
- Language: Go
- Size: 28.3 KB
- Stars: 14
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/guumaster/surveygen/releases)
[](https://goreportcard.com/report/github.com/guumaster/surveygen)
[](https://github.com/guumaster/surveygen/LICENSE)
# surveygen
> generate interactive surveys from yaml files
Generate code for surveys that you can use with [github.com/AlecAivazis/survey](https://github.com/AlecAivazis/survey/v2).
It will save you some time if you need to maintain large surveys and prefer to keep a simple yaml file instead of code.
Check [an example yaml](example/demo/my_awesome_survey.yaml) to see how to create it and use it in [code](example/main.go).
## Installation
### Binaries
Go to [release page](https://github.com/guumaster/surveygen/releases) and download the binary you need.
### Module
go get github.com/guumaster/surveygen
### Usage as CLI:
```
surveygen is a CLI tool to generate go code for surveys from a yaml definition file.
Usage:
surveygen [flags]
Flags:
-h, --help help for surveygen
-p, --path strings path to look for survey definitions (default [$CWD])
```
## Usage as module:
cd into your project root folder, then run:
```
$> go run github.com/guumaster/surveygen . --path path/to/your/survey
```
## Usage with `go generate`
Add the following line to your main or any other .go file you prefer:
```
//go:generate surveygen --path demo --path path/to/your/survey --path another/path
```
### TODO
Features that I'd like to add:
* [ ] Some more documentation
* [ ] Allow usage as module to generate questions on the fly instead of generating code
* [ ] Validate yaml content, right now it may panic or generate wrong code
### References
* [spf13/cobra](https://github.com/spf13/cobra)
* [AlecAivazis/survey](https://github.com/AlecAivazis/survey)
### LICENSE
[MIT license](LICENSE)
### Author(s)
* [guumaster](https://github.com/guumaster)