https://github.com/rqlite/flagforge
FlagSet creation and documentation for Go programs
https://github.com/rqlite/flagforge
Last synced: 4 months ago
JSON representation
FlagSet creation and documentation for Go programs
- Host: GitHub
- URL: https://github.com/rqlite/flagforge
- Owner: rqlite
- License: mit
- Created: 2024-12-05T17:22:03.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-08-28T02:16:06.000Z (5 months ago)
- Last Synced: 2025-08-28T09:34:42.143Z (5 months ago)
- Language: Go
- Size: 61.5 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flagforge
[](https://circleci.com/gh/rqlite/flagforge/tree/master)
_flagforge_ allows you to automatically generate Go [flag](https://pkg.go.dev/flag) code, as well as the associated Markdown and HTML documentation for those flags, all using a single configuration file. This means you only have to define your command-line options once in a TOML file, and _flagforge_ will do the rest.
## Running _flagforge_
Clone the repo and execute `go build`. Pass `-h` to `flagforge` to learn how to use it.
```bash
flagforge -f go|markdown|html
```
## Example usage
[rqlite](https://www.rqlite.io) uses flagforge to generate the code and documentation for its extensive set of command-line flags:
- [rqlite TOML file](https://github.com/rqlite/rqlite/blob/v8.36.8/cmd/rqlited/flags.toml)
- [Generated Go code](https://github.com/rqlite/rqlite/blob/v8.36.8/cmd/rqlited/config_flags.go) for command-line flag parsing, and then [calling the generated code](https://github.com/rqlite/rqlite/blob/v8.36.8/cmd/rqlited/flags.go#L297) from rqlite.
- Example of [automatically generated HTML documentation](https://rqlite.io/docs/guides/config/) for the flags deployed to production site. You can review the generated HTML [here](https://raw.githubusercontent.com/rqlite/rqlite.io/refs/heads/master/content/en/docs/Guides/config/_index.md).