fix(config): don't throw error when file not available on OS
This commit is contained in:
parent
d3bab447e0
commit
a0662e9066
|
@ -88,6 +88,10 @@ func getSSHConfig(uriFlag string) (*ssh.ClientConfig, string, string, error) {
|
||||||
|
|
||||||
var currentUser *osUser.User
|
var currentUser *osUser.User
|
||||||
currentUser, err = osUser.Current()
|
currentUser, err = osUser.Current()
|
||||||
|
if err != nil {
|
||||||
|
return nil, "", "", err
|
||||||
|
}
|
||||||
|
|
||||||
user = currentUser.Username
|
user = currentUser.Username
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,10 @@ func (e *Items) Action(action string) {
|
||||||
PrintError("[%d] failed to resolve item paths \"%v\": %v", i, l, err)
|
PrintError("[%d] failed to resolve item paths \"%v\": %v", i, l, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if storagePath == "" && systemPath == "" {
|
||||||
|
color.Blue("[%d] file doesn't have configuration path for current OS. Skipping...")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if action == "save" {
|
if action == "save" {
|
||||||
src = systemPath
|
src = systemPath
|
||||||
|
|
|
@ -97,11 +97,17 @@ func ConfigPaths(os configuration.OSLocation, location string) (string, string,
|
||||||
|
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "linux":
|
case "linux":
|
||||||
|
if os.Linux == "" {
|
||||||
|
return "", "", nil
|
||||||
|
}
|
||||||
src, dst, err = getPaths(os.Linux, location)
|
src, dst, err = getPaths(os.Linux, location)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
}
|
}
|
||||||
case "darwin":
|
case "darwin":
|
||||||
|
if os.Darwin == "" {
|
||||||
|
return "", "", nil
|
||||||
|
}
|
||||||
src, dst, err = getPaths(os.Darwin, location)
|
src, dst, err = getPaths(os.Darwin, location)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
|
|
Reference in New Issue