@@ -20,17 +20,16 @@ package cli
2020import (
2121 "context"
2222 "errors"
23- "os"
24- "path/filepath"
25-
2623 "github.com/arduino/arduino-cli/arduino/cores/packagemanager"
2724 "github.com/arduino/arduino-cli/arduino/libraries/librariesmanager"
2825 "github.com/arduino/arduino-cli/commands"
2926 "github.com/arduino/arduino-cli/common/formatter"
3027 "github.com/arduino/arduino-cli/configs"
28+ "github.com/arduino/arduino-cli/global"
3129 "github.com/arduino/arduino-cli/rpc"
32- paths "github.com/arduino/go-paths-helper"
30+ "github.com/arduino/go-paths-helper"
3331 "github.com/sirupsen/logrus"
32+ "os"
3433)
3534
3635// Error codes to be used for os.Exit().
@@ -61,9 +60,6 @@ var GlobalFlags struct {
6160 OutputJSON bool // true output in JSON, false output as Text
6261}
6362
64- // AppName is the command line name of the Arduino CLI executable
65- var AppName = filepath .Base (os .Args [0 ])
66-
6763var Config * configs.Configuration
6864
6965func packageManagerInitReq () * rpc.InitReq {
@@ -116,7 +112,7 @@ func CreateInstance() *rpc.Instance {
116112 for _ , err := range resp .GetPlatformsIndexErrors () {
117113 formatter .PrintError (errors .New (err ), "Error loading index" )
118114 }
119- formatter .PrintErrorMessage ("Launch '" + AppName + " core update-index' to fix or download indexes." )
115+ formatter .PrintErrorMessage ("Launch '" + global . GetAppName () + " core update-index' to fix or download indexes." )
120116 os .Exit (ErrGeneric )
121117 }
122118 return resp .GetInstance ()
0 commit comments