Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
da73a114
Commit
da73a114
authored
Feb 11, 2019
by
Matteo Suppo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use config.Navigate in command root
parent
47126622
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
commands/root/root.go
commands/root/root.go
+17
-3
No files found.
commands/root/root.go
View file @
da73a114
...
...
@@ -18,8 +18,10 @@
package
root
import
(
"fmt"
"io/ioutil"
"os"
"path/filepath"
"github.com/arduino/arduino-cli/output"
...
...
@@ -115,6 +117,7 @@ func preRun(cmd *cobra.Command, args []string) {
// initConfigs initializes the configuration from the specified file.
func
initConfigs
()
{
// Start with default configuration
if
conf
,
err
:=
configs
.
NewConfiguration
();
err
!=
nil
{
logrus
.
WithError
(
err
)
.
Error
(
"Error creating default configuration"
)
formatter
.
PrintError
(
err
,
"Error creating default configuration"
)
...
...
@@ -123,14 +126,25 @@ func initConfigs() {
commands
.
Config
=
conf
}
// Navigate through folders
pwd
,
err
:=
filepath
.
Abs
(
"."
)
if
err
!=
nil
{
logrus
.
WithError
(
err
)
.
Warn
(
"Did not manage to find current path"
)
}
commands
.
Config
.
Navigate
(
"/"
,
pwd
)
fmt
.
Println
(
yamlConfigFile
)
if
yamlConfigFile
!=
""
{
commands
.
Config
.
ConfigFile
=
paths
.
New
(
yamlConfigFile
)
if
err
:=
commands
.
Config
.
LoadFromYAML
(
commands
.
Config
.
ConfigFile
);
err
!=
nil
{
logrus
.
WithError
(
err
)
.
Warn
(
"Did not manage to get config file, using default configuration"
)
}
}
logrus
.
Info
(
"Initiating configuration"
)
if
err
:=
commands
.
Config
.
LoadFromYAML
(
commands
.
Config
.
ConfigFile
);
err
!=
nil
{
logrus
.
WithError
(
err
)
.
Warn
(
"Did not manage to get config file, using default configuration"
)
}
if
commands
.
Config
.
IsBundledInDesktopIDE
()
{
logrus
.
Info
(
"CLI is bundled into the IDE"
)
err
:=
commands
.
Config
.
LoadFromDesktopIDEPreferences
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment