Skip to content

Commit ab41245

Browse files
committed
Minor tweak to show args for help
1 parent 3f90fc4 commit ab41245

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

cmd/hosty/hosty.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ func printValidationResult(ok bool, onInvalid string, original string) {
134134
}
135135

136136
func main() {
137-
var help = pflag.BoolP("help", "h", false, "Show help message")
138-
var version = pflag.Bool("version", false, "Print version information")
139-
140137
var toPunycode = pflag.Bool("to-punycode", false, "Convert hostname to punycode")
141138
var fromPunycode = pflag.Bool("from-punycode", false, "Convert punycode hostname to Unicode")
142139
var getPublicSuffix = pflag.Bool("public-suffix", false, "Output public suffix")
@@ -151,6 +148,9 @@ func main() {
151148
var checkSuffix = pflag.Bool("check-suffix", false, "Validate that input is a known public suffix")
152149
var onInvalid = pflag.String("on-invalid", "exit", "Validation failure behavior: exit, blank, original")
153150

151+
var help = pflag.BoolP("help", "h", false, "Show help message")
152+
var version = pflag.Bool("version", false, "Print version information")
153+
154154
pflag.Parse()
155155

156156
if *version {
@@ -160,6 +160,7 @@ func main() {
160160

161161
if *help {
162162
fmt.Printf("Usage: hosty [options] <hostname>\n\n")
163+
pflag.PrintDefaults()
163164
fmt.Printf("%s\n", helpText)
164165
return
165166
}

0 commit comments

Comments
 (0)