Skip to content

Commit ee34423

Browse files
authored
Updated help usage test (#13)
1 parent 95d6326 commit ee34423

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@master
19+
uses: actions/checkout@v1
2020

2121
- name: Setup go
2222
uses: actions/setup-go@v1

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func mainCmd() (bool, error) {
4141
flag.DurationVar(&spec.Sleep, "sleep", 5*time.Second, "time to sleep between attempts")
4242
flag.DurationVar(&spec.TaskTime, "task-time", 0, "maximum time for a single attempt")
4343
flag.BoolVar(&versionFlag, "version", false, fmt.Sprintf("print the version %q and exit", version))
44+
flag.Usage = usage
4445
flag.Parse()
4546

4647
// If the version flag (-version) was given, print the version and exit.
@@ -79,3 +80,8 @@ func mainCmd() (bool, error) {
7980
return false, nil
8081
}
8182
}
83+
84+
func usage() {
85+
fmt.Fprintf(flag.CommandLine.Output(), "Usage: retry [flags] command|url\n")
86+
flag.PrintDefaults()
87+
}

0 commit comments

Comments
 (0)