diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/pkg/server/ui/usageinputs.go b/pkg/server/ui/usageinputs.go index 1508d07..c634c6d 100644 --- a/pkg/server/ui/usageinputs.go +++ b/pkg/server/ui/usageinputs.go @@ -2,6 +2,7 @@ package ui import ( "fmt" + "strings" ) type UsageInputs struct { @@ -38,12 +39,21 @@ func addSshKeys(shell Shell, keys []string) string { } res := "" for index, key := range keys { + key = strings.TrimSpace(key) + if key == "" { + continue + } operator := ">>" if index == 0 { operator = ">" } if shell == POWERSHELL { - res += fmt.Sprintf(`"%s" | Out-File -FilePath ".authorized_keys" -Encoding ASCII
`, key) + append := "" + if index > 0 { + append = "-Append " + } + res += fmt.Sprintf(`"%s" | Out-File %s-FilePath ".authorized_keys" -Encoding ASCII
`, + key, append) } else { res += fmt.Sprintf(" echo %s%s%s %s .authorized_keys
", quote, key, quote, operator)