Skip to content

Commit 8ece92d

Browse files
committed
extra help
1 parent 1d6698f commit 8ece92d

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@ Prints GitHub project description for every direct dependency on GitHub in go.mo
66

77
## Usage
88

9+
```
10+
usage: expmod [options] [file or URL]
11+
Options:
12+
-timeout duration
13+
HTTP timeout (default 3s)
14+
-version
15+
show version and exit
16+
17+
If GITHUB_TOKEN is found in the environment, it will be use to access GitHub API.
18+
"Human" GitHub URLs (e.g. https://github.com/tebeka/expmod/blob/main/go.mod) will be redirected to raw content.
19+
```
20+
21+
22+
## Example
23+
924
```
1025
$ expmod go.mod
1126
github.com/sahilm/fuzzy v0.1.0:

main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,19 @@ const (
3030
tokenKey = "GITHUB_TOKEN" // #nosec G101
3131
)
3232

33+
var extraHelp = `
34+
If %s is found in the environment, it will be use to access GitHub API.
35+
"Human" GitHub URLs (e.g. https://github.com/tebeka/expmod/blob/main/go.mod) will be redirected to raw content.
36+
`
37+
3338
func main() {
3439
exe := path.Base(os.Args[0])
3540
flag.BoolVar(&showVersion, "version", false, "show version and exit")
3641
flag.DurationVar(&httpTimeout, "timeout", 3*time.Second, "HTTP timeout")
3742
flag.Usage = func() {
3843
fmt.Fprintf(os.Stderr, "usage: %s [options] [file or URL]\nOptions:\n", exe)
3944
flag.PrintDefaults()
40-
fmt.Fprintln(os.Stderr)
41-
fmt.Fprintf(os.Stderr, "If %s is found in the environment, it will be use to access GitHub API.\n", tokenKey)
45+
fmt.Fprintf(os.Stderr, extraHelp, tokenKey)
4246
}
4347
flag.Parse()
4448

0 commit comments

Comments
 (0)