Skip to content

Commit

Permalink
feat: add env rules to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed Apr 14, 2023
1 parent fe941e3 commit 2eb2959
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/tagliatelle/tagliatelle.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func main() {
"avro": "snake",
"header": "header",
"envconfig": "upperSnake",
"env": "upperSnake",
},
UseFieldName: true,
}
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Here are the default rules for the well known and used tags, when using tagliate
- `bson`: `camel`
- `avro`: `snake`
- `header`: `header`
- `env`: `upperSnake`
- `envconfig`: `upperSnake`

### Custom Rules
Expand Down
1 change: 1 addition & 0 deletions tagliatelle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func TestAnalyzer(t *testing.T) {
"mapstructure": "kebab",
"header": "header",
"envconfig": "upperSnake",
"env": "upperSnake",
},
UseFieldName: true,
}
Expand Down
2 changes: 2 additions & 0 deletions testdata/src/a/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type Bur struct {
WrongHeaderValue string `header:"Header_Value"` // want `header\(header\): got 'Header_Value' want 'Wrong-Header-Value'`
EnvConfigValue string `envconfig:"ENV_CONFIG_VALUE"`
WrongEnvConfigValue string `envconfig:"env_config_value"` // want `envconfig\(upperSnake\): got 'env_config_value' want 'WRONG_ENV_CONFIG_VALUE'`
EnvValue string `env:"ENV_VALUE"`
WrongEnvValue string `env:"env_value"` // want `env\(upperSnake\): got 'env_value' want 'WRONG_ENV_VALUE'`
}

type Quux struct {
Expand Down

0 comments on commit 2eb2959

Please sign in to comment.