https://github.com/paralin/envconfcli
Convert envconf tagged structs to cli flags.
https://github.com/paralin/envconfcli
Last synced: 28 days ago
JSON representation
Convert envconf tagged structs to cli flags.
- Host: GitHub
- URL: https://github.com/paralin/envconfcli
- Owner: paralin
- License: mit
- Created: 2018-05-26T06:05:41.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-26T06:08:15.000Z (almost 8 years ago)
- Last Synced: 2025-10-05T22:36:22.117Z (5 months ago)
- Size: 1000 Bytes
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Envconf to CLI
> Automatically convert envconfig projects to urfave/cli flags.
## Introduction
Many old projects use [envconfig](https://github.com/kelseyhightower/envconfig) to configure with environment variables:
```go
// Config is the environment-supplied config.
type Config struct {
ServiceURL string `envconfig:"SERVICE_URL"`
}
```
We might want to format this as a cli flag:
```go
cli.StringFlag{
Name: "service-url",
EnvVar: "SERVICE_URL",
Destination: &config.ServiceURL,
}
```
This package generates this relation automatically:
```go
// GenerateCliFlags builds flags for the envconfig tagged fields.
// Obj must be a struct pointer.
func GenerateCliFlags(obj interface{}) []cli.Flag
```
## Development Status
Status: **design/concept phase**