summaryrefslogtreecommitdiff
path: root/internal/client
diff options
context:
space:
mode:
Diffstat (limited to 'internal/client')
-rw-r--r--internal/client/ui/auth/auth.go28
-rw-r--r--internal/client/ui/core/networklist/networklist.go4
-rw-r--r--internal/client/ui/whitespace.go14
3 files changed, 14 insertions, 32 deletions
diff --git a/internal/client/ui/auth/auth.go b/internal/client/ui/auth/auth.go
index 3f89298..d4c4d2f 100644
--- a/internal/client/ui/auth/auth.go
+++ b/internal/client/ui/auth/auth.go
@@ -416,13 +416,13 @@ func (m *Model) Signup() tea.Cmd {
hasPassphrase := len(passphrase) != 0
hasConfirmation := len(confirmation) != 0
if hasPassphrase && !hasConfirmation {
- m.fields[passphraseConfirmField].Input.Err = errors.New("Confirmation required")
+ m.fields[passphraseConfirmField].Input.Err = errors.New("confirmation required")
return nil
} else if !hasPassphrase && hasConfirmation {
- m.fields[passphraseField].Input.Err = errors.New("Empty passphrase")
+ m.fields[passphraseField].Input.Err = errors.New("empty passphrase")
return nil
} else if hasPassphrase && hasConfirmation && passphrase != confirmation {
- m.fields[passphraseConfirmField].Input.Err = errors.New("Passphrase mismatch")
+ m.fields[passphraseConfirmField].Input.Err = errors.New("passphrase mismatch")
return nil
}
@@ -438,7 +438,7 @@ func (m *Model) Signup() tea.Cmd {
info, e := os.Stat(privateKeyFilepath)
assert.NoError(e, "if file exists it should be fine to stat it")
if info.IsDir() {
- m.fields[privateKeyField].Input.Err = errors.New("File is a directory")
+ m.fields[privateKeyField].Input.Err = errors.New("file is a directory")
return nil
}
content := fmt.Sprintf("File '%s' exists.\nDo you want to sign-in instead?", privateKeyFilepath)
@@ -448,7 +448,7 @@ func (m *Model) Signup() tea.Cmd {
if err != nil {
m.fields[privateKeyField].Input.Err = errors.Unwrap(err)
if errors.Unwrap(err).Error() == "is a directory" {
- m.fields[privateKeyField].Input.Err = errors.New("File is a directory")
+ m.fields[privateKeyField].Input.Err = errors.New("file is a directory")
}
log.Println("signup open file error:", err)
assert.NotNil(errors.Unwrap(err), "there should always be an error to unwrap", "err", err)
@@ -458,7 +458,7 @@ func (m *Model) Signup() tea.Cmd {
_, privKey, err := ed25519.GenerateKey(nil)
if err != nil {
- m.fields[privateKeyField].Input.Err = errors.New("Failed private key generation")
+ m.fields[privateKeyField].Input.Err = errors.New("failed private key generation")
log.Println("ed25519 generate key error:", err)
return nil
}
@@ -469,13 +469,13 @@ func (m *Model) Signup() tea.Cmd {
pemBlock, err = ssh.MarshalPrivateKey(privKey, username)
}
if err != nil {
- m.fields[privateKeyField].Input.Err = errors.New("Failed private key marshaling")
+ m.fields[privateKeyField].Input.Err = errors.New("failed private key marshaling")
log.Println("ssh marshaling error:", err)
return nil
}
err = pem.Encode(file, pemBlock)
if err != nil {
- m.fields[privateKeyField].Input.Err = errors.New("Failed writing to disk")
+ m.fields[privateKeyField].Input.Err = errors.New("failed writing to disk")
log.Println("pem encoding to file error:", err)
return nil
}
@@ -494,7 +494,7 @@ func (m *Model) signin() tea.Cmd {
if err != nil {
m.fields[privateKeyField].Input.Err = errors.Unwrap(err)
if errors.Unwrap(err).Error() == "is a directory" {
- m.fields[privateKeyField].Input.Err = errors.New("File is a directory")
+ m.fields[privateKeyField].Input.Err = errors.New("file is a directory")
}
assert.NotNil(errors.Unwrap(err), "there should always be an error to unwrap", "err", err)
return nil
@@ -506,26 +506,26 @@ func (m *Model) signin() tea.Cmd {
if len(passphrase) == 0 {
privateKey, err = ssh.ParseRawPrivateKey(file)
if err, ok := err.(*ssh.PassphraseMissingError); ok {
- m.fields[passphraseField].Input.Err = errors.New("Missing passphrase")
+ m.fields[passphraseField].Input.Err = errors.New("missing passphrase")
log.Println("passphrase missing:", err)
return nil
}
if err != nil {
- m.fields[privateKeyField].Input.Err = errors.New("Invalid private key file format")
+ m.fields[privateKeyField].Input.Err = errors.New("invalid private key file format")
log.Println("passphrase error:", err)
return nil
}
} else {
privateKey, err = ssh.ParseRawPrivateKeyWithPassphrase(file, []byte(passphrase))
if err == x509.IncorrectPasswordError {
- m.fields[passphraseField].Input.Err = errors.New("Incorrect Passphrase")
+ m.fields[passphraseField].Input.Err = errors.New("incorrect Passphrase")
return nil
}
if err != nil && (err.Error() == "ssh: not an encrypted key" || err.Error() == "ssh: key is not password protected") {
privateKey, err = ssh.ParseRawPrivateKey(file)
}
if err != nil {
- m.fields[privateKeyField].Input.Err = errors.New("Invalid private key file format")
+ m.fields[privateKeyField].Input.Err = errors.New("invalid private key file format")
log.Println("passphrase error:", err)
return nil
}
@@ -533,7 +533,7 @@ func (m *Model) signin() tea.Cmd {
privKey, ok := privateKey.(*ed25519.PrivateKey)
if !ok {
- m.fields[privateKeyField].Input.Err = errors.New("Must be ed25519")
+ m.fields[privateKeyField].Input.Err = errors.New("must be ed25519")
keyType := reflect.TypeOf(privateKey)
log.Println("incorrect private key type, got:", keyType.String(), reflect.ValueOf(privateKey).String())
return nil
diff --git a/internal/client/ui/core/networklist/networklist.go b/internal/client/ui/core/networklist/networklist.go
index 96b2e33..23350a3 100644
--- a/internal/client/ui/core/networklist/networklist.go
+++ b/internal/client/ui/core/networklist/networklist.go
@@ -16,10 +16,6 @@ import (
var (
sepStyle = lipgloss.NewStyle().Width(0).
Border(lipgloss.ThickBorder(), false, true, false, false)
- partialIconStyle = lipgloss.NewStyle().
- Width(6).Height(3).
- Align(lipgloss.Center).
- Border(lipgloss.ThickBorder(), false, false)
selectedIndicator = "šŸ­€\nā–Œ\nšŸ­›"
trustedUsersIcon = IconStyle("ī· ", colors.Turquoise, colors.DarkerCyan)
diff --git a/internal/client/ui/whitespace.go b/internal/client/ui/whitespace.go
index c7c7d88..98dcac1 100644
--- a/internal/client/ui/whitespace.go
+++ b/internal/client/ui/whitespace.go
@@ -15,20 +15,6 @@ type whitespace struct {
chars string
}
-// newWhitespace creates a new whitespace renderer. The order of the options
-// matters, if you're using WithWhitespaceRenderer, make sure it comes first as
-// other options might depend on it.
-func newWhitespace(r *lipgloss.Renderer, opts ...WhitespaceOption) *whitespace {
- w := &whitespace{
- re: r,
- style: r.ColorProfile().String(),
- }
- for _, opt := range opts {
- opt(w)
- }
- return w
-}
-
// Render whitespaces.
func (w whitespace) render(width int) string {
if w.chars == "" {