Skip to content

Commit

Permalink
update readme for new quoting (#6)
Browse files Browse the repository at this point in the history
* update readme for new quoting

* \n is inline now
  • Loading branch information
ldemailly authored Nov 6, 2023
1 parent ba71163 commit 752d976
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@ type FooConfig struct {

Turns into
```shell
TST_FOO="a\nfoo with \" quotes and \\ and '"
TST_BAR="42str"
TST_A_SPECIAL_BLAH="42"
TST_FOO='a
foo with $, `, " quotes, \ and '\'' quotes'
TST_BAR='42str'
TST_A_SPECIAL_BLAH='42'
TST_A_BOOL=true
TST_HTTP_SERVER="http://localhost:8080"
TST_INT_POINTER="199"
TST_HTTP_SERVER='http://localhost:8080'
TST_INT_POINTER='199'
TST_FLOAT_POINTER='3.14'
```

Using
```go
kv, errs := struct2env.StructToEnvVars(foo)
struct2env.ToShellWithPrefix("TST_", kv)
txt := struct2env.ToShellWithPrefix("TST_", kv)
```

0 comments on commit 752d976

Please sign in to comment.