fix(config): don't throw error when file not available on OS

This commit is contained in:
DataHearth 2022-06-14 11:31:35 +02:00
parent d3bab447e0
commit a0662e9066
No known key found for this signature in database
GPG Key ID: E88FD356ACC5F3C4
3 changed files with 14 additions and 0 deletions

View File

@ -88,6 +88,10 @@ func getSSHConfig(uriFlag string) (*ssh.ClientConfig, string, string, error) {
var currentUser *osUser.User
currentUser, err = osUser.Current()
if err != nil {
return nil, "", "", err
}
user = currentUser.Username
}

View File

@ -51,6 +51,10 @@ func (e *Items) Action(action string) {
PrintError("[%d] failed to resolve item paths \"%v\": %v", i, l, err)
continue
}
if storagePath == "" && systemPath == "" {
color.Blue("[%d] file doesn't have configuration path for current OS. Skipping...")
continue
}
if action == "save" {
src = systemPath

View File

@ -97,11 +97,17 @@ func ConfigPaths(os configuration.OSLocation, location string) (string, string,
switch runtime.GOOS {
case "linux":
if os.Linux == "" {
return "", "", nil
}
src, dst, err = getPaths(os.Linux, location)
if err != nil {
return "", "", err
}
case "darwin":
if os.Darwin == "" {
return "", "", nil
}
src, dst, err = getPaths(os.Darwin, location)
if err != nil {
return "", "", err