Skip to content

Commit 83b3f27

Browse files
author
Måns Thörnvik
committed
fix README
1 parent 62dfef4 commit 83b3f27

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# envparser
22

3-
[![Lint, test, and build](https://github.com/trebent/envparser/actions/workflows/build.yaml/badge.svg)](https://github.com/trebent/envparser/actions/workflows/build.yaml)
3+
[![Main branch protection](https://github.com/trebent/envparser/actions/workflows/main-protection.yaml/badge.svg)](https://github.com/trebent/envparser/actions/workflows/main-protection.yaml)
44

55
Declare your application environment variables in a standardised way!
66

@@ -9,6 +9,7 @@ Declare your application environment variables in a standardised way!
99
Tired of inconsistent environment variable handling 😮‍💨? Tired of having to use `os.LookupEnv` and implementing parsing every time you need to extract a value 😩? Are you especially tired of seeing duplicate code blocks when variables are used in more than one place 😤? Enter standardized environment variable parsing!
1010

1111
A stepwise instruction for a better way of life:
12+
1213
1. Define a place where you want your environment variables to be declared. This could be your application's main entrypoint, or a separate `env` package, whatever your heart desires.
1314
2. Register your environment variables in the chosen place. Determine which are required and their datatypes.
1415
3. Call `Parse()` and your declared variables are good to go.
@@ -32,12 +33,12 @@ var (
3233
func main() {
3334
// Output the environment parser help text to stdout when --help is executed.
3435
flag.CommandLine.SetOutput(os.Stdout)
35-
flag.Usage = func() {
36-
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
37-
fmt.Fprintf(flag.CommandLine.Output(), "\n")
38-
fmt.Fprintf(flag.CommandLine.Output(), envparser.Help())
39-
}
40-
flag.Parse()
36+
flag.Usage = func() {
37+
fmt.Fprintf(flag.CommandLine.Output(), "Usage of %s:\n", os.Args[0])
38+
fmt.Fprintf(flag.CommandLine.Output(), "\n")
39+
fmt.Fprintf(flag.CommandLine.Output(), envparser.Help())
40+
}
41+
flag.Parse()
4142

4243
// Exits with exit code 1 in case the registered environment variables could
4344
// not be parsed according to the rules you set up.

0 commit comments

Comments
 (0)