From 405bda7e9981183d0a55f708804eeb99bc0f32e1 Mon Sep 17 00:00:00 2001 From: Kevin Minehart Date: Thu, 20 Apr 2023 12:51:50 -0500 Subject: [PATCH] Packaging: Added deprecation warnings when running `grafana-cli` or `grafana-server`; the `grafana` command should be used instead. (#66976) * Add grafana-cli and grafana-server deprecation warnings * remove extra : --- pkg/util/cmd/cmd.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/util/cmd/cmd.go b/pkg/util/cmd/cmd.go index b0ec8b07501..85d9e8be1f2 100644 --- a/pkg/util/cmd/cmd.go +++ b/pkg/util/cmd/cmd.go @@ -8,6 +8,8 @@ import ( "path/filepath" "runtime" "syscall" + + "github.com/fatih/color" ) func RunGrafanaCmd(subCmd string) int { @@ -17,6 +19,13 @@ func RunGrafanaCmd(subCmd string) int { return 1 } + switch filepath.Base(curr) { + case "grafana-server": + fmt.Printf("%s: %s\n", color.RedString("Deprecation warning"), "The standalone 'grafana-server' program is deprecated and will be removed in the future. Please update all uses of 'grafana-server' to 'grafana server'") + case "grafana-cli": + fmt.Printf("%s: %s\n", color.RedString("Deprecation warning"), "The standalone 'grafana-cli' program is deprecated and will be removed in the future. Please update all uses of 'grafana-cli' to 'grafana cli'") + } + executable := "grafana" if runtime.GOOS == "windows" { executable += ".exe"