From 48019c3e80bd7553361ca8ed47b5bf2cce5c08e2 Mon Sep 17 00:00:00 2001 From: Max Ma Date: Mon, 27 May 2024 21:42:52 +0200 Subject: [PATCH 1/2] deprecate Windows cmd install --- cmd/install.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/install.go b/cmd/install.go index 4c251a73..0102ac2f 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -4,6 +4,10 @@ Copyright © 2022 Netmaker Team package cmd import ( + "errors" + "log/slog" + "runtime" + "github.com/gravitl/netclient/functions" "github.com/spf13/cobra" ) @@ -17,6 +21,14 @@ var installCmd = &cobra.Command{ ./netclient install [command options] [arguments] ensure you specify the full path to then new binary to be installed`, + PreRunE: func(cmd *cobra.Command, args []string) error { + if runtime.GOOS == "windows" { + cmd.SilenceUsage = true + slog.Warn("cmd install on Windows is deprecated, please install with msi installer") + return errors.New("cmd install on Windows is deprecated, please install with msi installer") + } + return nil + }, Run: func(cmd *cobra.Command, args []string) { functions.Install() }, From 86bef439f2a07eebb7bf4645e2cb1ef5fad4cb22 Mon Sep 17 00:00:00 2001 From: Max Ma Date: Mon, 27 May 2024 21:48:36 +0200 Subject: [PATCH 2/2] remove slog message --- cmd/install.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/install.go b/cmd/install.go index 0102ac2f..01f735e4 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -5,7 +5,6 @@ package cmd import ( "errors" - "log/slog" "runtime" "github.com/gravitl/netclient/functions" @@ -24,7 +23,6 @@ ensure you specify the full path to then new binary to be installed`, PreRunE: func(cmd *cobra.Command, args []string) error { if runtime.GOOS == "windows" { cmd.SilenceUsage = true - slog.Warn("cmd install on Windows is deprecated, please install with msi installer") return errors.New("cmd install on Windows is deprecated, please install with msi installer") } return nil