From 91d135e06927a7fdfb8f1315c941d25df39cbe4f Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Thu, 14 Oct 2021 23:54:07 +0200 Subject: [PATCH 1/2] Show JSON when error on expire key (fixes #162) --- cmd/headscale/cli/preauthkeys.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/headscale/cli/preauthkeys.go b/cmd/headscale/cli/preauthkeys.go index cb75b28..caa9201 100644 --- a/cmd/headscale/cli/preauthkeys.go +++ b/cmd/headscale/cli/preauthkeys.go @@ -153,6 +153,10 @@ var expirePreAuthKeyCmd = &cobra.Command{ k, err := h.GetPreAuthKey(n, args[0]) if err != nil { + if strings.HasPrefix(o, "json") { + JsonOutput(k, err, o) + return + } log.Fatalf("Error getting the key: %s", err) } From 0d13e16fed9a57b100fe3262f3cc6f533950a431 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Thu, 14 Oct 2021 23:58:15 +0200 Subject: [PATCH 2/2] Improve help message to expire key (fixes #161) --- cmd/headscale/cli/preauthkeys.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/headscale/cli/preauthkeys.go b/cmd/headscale/cli/preauthkeys.go index cb75b28..421e7ef 100644 --- a/cmd/headscale/cli/preauthkeys.go +++ b/cmd/headscale/cli/preauthkeys.go @@ -131,7 +131,7 @@ var createPreAuthKeyCmd = &cobra.Command{ } var expirePreAuthKeyCmd = &cobra.Command{ - Use: "expire", + Use: "expire KEY", Short: "Expire a preauthkey", Args: func(cmd *cobra.Command, args []string) error { if len(args) < 1 {