From 5da3d7f6a0bab74b229f24263b77b9426ca60b5f Mon Sep 17 00:00:00 2001 From: Grégoire Détrez Date: Wed, 18 May 2022 15:57:42 +0200 Subject: Make sigsum-debug print help if subcommand is omitted Issue #52 --- cmd/sigsum-debug/head/head.go | 2 +- cmd/sigsum-debug/key/key.go | 2 +- cmd/sigsum-debug/leaf/leaf.go | 2 +- cmd/sigsum-debug/main.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/sigsum-debug/head/head.go b/cmd/sigsum-debug/head/head.go index b1b3044..22b857b 100644 --- a/cmd/sigsum-debug/head/head.go +++ b/cmd/sigsum-debug/head/head.go @@ -42,7 +42,7 @@ func Main(args []string) error { err = checkOptions(opt.Name()) if err == nil { switch opt.Name() { - case "help": + case "help", "": opt.Usage() case "sign": err = sign.Main(opt.Args(), optPrivateKey, optKeyHash) diff --git a/cmd/sigsum-debug/key/key.go b/cmd/sigsum-debug/key/key.go index 88973f2..0d9e580 100644 --- a/cmd/sigsum-debug/key/key.go +++ b/cmd/sigsum-debug/key/key.go @@ -28,7 +28,7 @@ func Main(args []string) error { opt := options.New(args, func() { log.Printf(usage[1:]) }, func(_ *flag.FlagSet) {}) switch opt.Name() { - case "help": + case "help", "": opt.Usage() case "private": err = private.Main(opt.Args()) diff --git a/cmd/sigsum-debug/leaf/leaf.go b/cmd/sigsum-debug/leaf/leaf.go index 97de37e..c14e6aa 100644 --- a/cmd/sigsum-debug/leaf/leaf.go +++ b/cmd/sigsum-debug/leaf/leaf.go @@ -46,7 +46,7 @@ func Main(args []string) error { err = checkOptions(opt.Name()) if err == nil { switch opt.Name() { - case "help": + case "help", "": opt.Usage() case "sign": err = sign.Main(opt.Args(), optPrivateKey, optShardHint) diff --git a/cmd/sigsum-debug/main.go b/cmd/sigsum-debug/main.go index 7a1c894..2c10be2 100644 --- a/cmd/sigsum-debug/main.go +++ b/cmd/sigsum-debug/main.go @@ -41,7 +41,7 @@ func main() { log.SetFlags(0) opt := options.New(os.Args[1:], func() { log.Printf(usage[1:]) }, func(_ *flag.FlagSet) {}) switch opt.Name() { - case "help": + case "help", "": opt.Usage() case "key": err = key.Main(opt.Args()) -- cgit v1.2.3