Skip to content

Commit 1b82a6f

Browse files
committed
Do not bail out if old-style config file is found
We will remove support for old-style config in the next release. This will allow a smooth transition to the new file name.
1 parent f526b36 commit 1b82a6f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

commands/root/root.go

+11-10
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,6 @@ func preRun(cmd *cobra.Command, args []string) {
116116

117117
// initConfigs initializes the configuration from the specified file.
118118
func initConfigs() {
119-
// Return error if an old configuration file is found
120-
if old := paths.New(".cli-config.yml"); old.Exist() {
121-
logrus.Errorf("Old configuration file detected: %s.", old)
122-
logrus.Info("The name of this file has been changed to `arduino-cli.yaml`, please rename the file fix it.")
123-
formatter.PrintError(
124-
fmt.Errorf("old configuration file detected: %s", old),
125-
"The name of this file has been changed to `arduino-cli.yaml`, please rename the file fix it.")
126-
os.Exit(commands.ErrGeneric)
127-
}
128-
129119
// Start with default configuration
130120
if conf, err := configs.NewConfiguration(); err != nil {
131121
logrus.WithError(err).Error("Error creating default configuration")
@@ -160,6 +150,17 @@ func initConfigs() {
160150
commands.Config.Navigate("/", pwd.String())
161151
}
162152

153+
// Read configuration from old configuration file if found, but output a warning.
154+
if old := paths.New(".cli-config.yml"); old.Exist() {
155+
logrus.Errorf("Old configuration file detected: %s.", old)
156+
logrus.Info("The name of this file has been changed to `arduino-cli.yaml`, please rename the file fix it.")
157+
formatter.PrintError(
158+
fmt.Errorf("WARNING: Old configuration file detected: %s", old),
159+
"The name of this file has been changed to `arduino-cli.yaml`, in a future release we will not support"+
160+
"the old name `.cli-config.yml` anymore. Please rename the file to `arduino-cli.yaml` to silence this warning.")
161+
readConfigFrom(old)
162+
}
163+
163164
// Read configuration from environment vars
164165
commands.Config.LoadFromEnv()
165166

0 commit comments

Comments
 (0)