From 01e8a6e859caea008ac8fde8f7ea6ab868bc4638 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 17 Feb 2025 15:37:04 -0500 Subject: [PATCH] main: fix the output if a wrong or none command provided Signed-off-by: Vincent Batts --- main.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 656f530..4fac742 100644 --- a/main.go +++ b/main.go @@ -15,12 +15,11 @@ import ( func main() { cmd := &cli.Command{ Name: "too-soon", - Usage: "check if something expires too soon", + Usage: "check if certificates expire too soon", Version: "0.1", Authors: []any{ &mail.Address{Name: "Vincent Batts", Address: "vbatts@hashbangbash.com"}, }, - DefaultCommand: "pem", Flags: []cli.Flag{ &cli.IntFlag{ Name: "days", @@ -42,10 +41,16 @@ func main() { }, Commands: []*cli.Command{ &cli.Command{ - Name: "pem", - Action: fPEMCheck, + Name: "pem", + Usage: "check if PEM certificate files expire too soon", + Action: fPEMCheck, + ArgsUsage: "[PEM files...]", }, }, + Action: func(ctx context.Context, cmd *cli.Command) error { + cli.ShowAppHelpAndExit(cmd, 1) + return nil + }, } if err := cmd.Run(context.Background(), os.Args); err != nil {