powershell instructions did not work when mukltiple ssh keys were configured.
Also ignoring empty lines in the input.
This commit is contained in:
parent
9508fca88f
commit
a0ae2d7d97
8
.idea/.gitignore
vendored
8
.idea/.gitignore
vendored
@ -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
|
@ -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<br/>`, key)
|
||||
append := ""
|
||||
if index > 0 {
|
||||
append = "-Append "
|
||||
}
|
||||
res += fmt.Sprintf(`"%s" | Out-File %s-FilePath ".authorized_keys" -Encoding ASCII<br/>`,
|
||||
key, append)
|
||||
} else {
|
||||
res += fmt.Sprintf(" echo %s%s%s %s .authorized_keys<br/>", quote, key, quote,
|
||||
operator)
|
||||
|
Loading…
Reference in New Issue
Block a user