Skip to content

Commit 46e59e7

Browse files
committed
refactor: rename "Add from SSH" to "Paste SSH" for better UX clarity
- Rename feature from "Add from SSH" to "Paste SSH" to better reflect the action - Move "Paste SSH" next to "Copy SSH" in all UI elements for logical grouping - Update function name from handleAddFromSSH() to handlePasteCommand() - Clarify in README as "Paste SSH (as new server)" to indicate the outcome The new naming creates a clear conceptual pairing with "Copy SSH": - "Copy SSH" exports existing server config to clipboard - "Paste SSH" imports SSH command from clipboard to create new server This change improves discoverability and makes the feature's purpose immediately obvious to users, following the familiar copy/paste paradigm.
1 parent ed5c0f8 commit 46e59e7

File tree

6 files changed

+29
-28
lines changed

6 files changed

+29
-28
lines changed

README.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ With lazyssh, you can quickly navigate, connect, manage, and transfer files betw
1515
### Server Management
1616
- 📜 Read & display servers from your `~/.ssh/config` in a scrollable list.
1717
- ➕ Add a new server from the UI by specifying alias, host/IP, username, port, identity file.
18-
- 📋 Add from SSH command in clipboard (e.g., paste `ssh user@host -p 2222` to quickly add).
18+
- 📋 Paste SSH command from clipboard (e.g., paste `ssh user@host -p 2222` to quickly add a server).
1919
- ✏ Edit existing server entries directly from the UI.
2020
- 🗑 Delete server entries safely.
2121
- 📌 Pin / unpin servers to keep favorites at the top.
@@ -139,23 +139,23 @@ make run
139139

140140
## ⌨️ Key Bindings
141141

142-
| Key | Action |
143-
| ----- | ----------------------------- |
144-
| / | Toggle search bar |
145-
| ↑↓/jk | Navigate servers |
146-
| Enter | SSH into selected server |
147-
| c | Copy SSH command to clipboard |
148-
| g | Ping selected server |
149-
| r | Refresh background data |
150-
| a | Add server |
151-
| v | Add from SSH (parse clipboard)|
152-
| e | Edit server |
153-
| t | Edit tags |
154-
| d | Delete server |
155-
| p | Pin/Unpin server |
156-
| s | Toggle sort field |
157-
| S | Reverse sort order |
158-
| q | Quit |
142+
| Key | Action |
143+
| ----- | ---------------------------------------------- |
144+
| / | Toggle search bar |
145+
| ↑↓/jk | Navigate servers |
146+
| Enter | SSH into selected server |
147+
| c | Copy SSH command to clipboard |
148+
| v | Paste SSH command from clipboard as new server |
149+
| g | Ping selected server |
150+
| r | Refresh background data |
151+
| a | Add server |
152+
| e | Edit server |
153+
| t | Edit tags |
154+
| d | Delete server |
155+
| p | Pin/Unpin server |
156+
| s | Toggle sort field |
157+
| S | Reverse sort order |
158+
| q | Quit |
159159

160160
Tip: The hint bar at the top of the list shows the most useful shortcuts.
161161

internal/adapters/ui/handlers.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ func (t *tui) handleGlobalKeys(event *tcell.EventKey) *tcell.EventKey {
4545
case 'a':
4646
t.handleServerAdd()
4747
return nil
48-
case 'v':
49-
t.handleAddFromSSH()
50-
return nil
5148
case 'e':
5249
t.handleServerEdit()
5350
return nil
@@ -66,6 +63,9 @@ func (t *tui) handleGlobalKeys(event *tcell.EventKey) *tcell.EventKey {
6663
case 'c':
6764
t.handleCopyCommand()
6865
return nil
66+
case 'v':
67+
t.handlePasteCommand()
68+
return nil
6969
case 'g':
7070
t.handlePingSelected()
7171
return nil
@@ -128,7 +128,7 @@ func (t *tui) handleCopyCommand() {
128128
}
129129
}
130130

131-
func (t *tui) handleAddFromSSH() {
131+
func (t *tui) handlePasteCommand() {
132132
// Read from clipboard
133133
cmd, err := clipboard.ReadAll()
134134
if err != nil {
@@ -149,7 +149,7 @@ func (t *tui) handleAddFromSSH() {
149149
return
150150
}
151151

152-
// Show form for user to confirm and edit
152+
// Show form for user to confirm and edit the pasted SSH command
153153
form := NewServerFormFromData(ServerFormAdd, data).
154154
OnSave(t.handleServerSave).
155155
OnCancel(t.handleFormCancel)

internal/adapters/ui/hint_bar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ import (
2222
func NewHintBar() *tview.TextView {
2323
hint := tview.NewTextView().SetDynamicColors(true)
2424
hint.SetBackgroundColor(tcell.Color233)
25-
hint.SetText("[#BBBBBB]Press [::b]/[-:-:b] to search… • ↑↓ Navigate • Enter SSH • c Copy SSH • g Ping r Refresha Addv Add from SSH • e Edit • t Tags • d Delete • p Pin/Unpin • s Sort[-]")
25+
hint.SetText("[#BBBBBB]Press [::b]/[-:-:b] to search… • ↑↓ Navigate • Enter SSH • c Copy SSH • v Paste SSH g Pingr Refresha Add • e Edit • t Tags • d Delete • p Pin/Unpin • s Sort[-]")
2626
return hint
2727
}

internal/adapters/ui/server_details.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func (sd *ServerDetails) UpdateServer(server domain.Server) {
7171
}
7272
tagsText := renderTagChips(server.Tags)
7373
text := fmt.Sprintf(
74-
"[::b]%s[-]\n\nHost: [white]%s[-]\nUser: [white]%s[-]\nPort: [white]%d[-]\nKey: [white]%s[-]\nTags: %s\nPinned: [white]%s[-]\nLast SSH: %s\nSSH Count: [white]%d[-]\n\n[::b]Commands:[-]\n Enter: SSH connect\n c: Copy SSH command\n g: Ping server\n r: Refresh list\n a: Add new server\n v: Add from SSH\n e: Edit entry\n t: Edit tags\n d: Delete entry\n p: Pin/Unpin",
74+
"[::b]%s[-]\n\nHost: [white]%s[-]\nUser: [white]%s[-]\nPort: [white]%d[-]\nKey: [white]%s[-]\nTags: %s\nPinned: [white]%s[-]\nLast SSH: %s\nSSH Count: [white]%d[-]\n\n[::b]Commands:[-]\n Enter: SSH connect\n c: Copy SSH command\n v: Paste SSH command as new server\n g: Ping server\n r: Refresh list\n a: Add new server\n e: Edit entry\n t: Edit tags\n d: Delete entry\n p: Pin/Unpin",
7575
server.Alias, server.Host, server.User, server.Port,
7676
serverKey, tagsText, pinnedStr,
7777
lastSeen, server.SSHCount)

internal/adapters/ui/ssh_parser.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ import (
2222
"github.com/Adembc/lazyssh/internal/core/domain"
2323
)
2424

25-
// ParseSSHCommand parses an SSH command string and returns ServerFormData
25+
// ParseSSHCommand parses an SSH command string from clipboard and returns ServerFormData
26+
// This is used for the "Paste SSH" feature to quickly create server entries from SSH commands
2627
// Supported formats:
2728
// - ssh user@host
2829
// - ssh host
@@ -143,7 +144,7 @@ func ParseSSHCommand(cmd string) (ServerFormData, error) {
143144
return data, nil
144145
}
145146

146-
// BuildServerFromSSHCommand builds a Server object from an SSH command
147+
// BuildServerFromSSHCommand builds a Server object from a pasted SSH command
147148
func BuildServerFromSSHCommand(cmd string) (domain.Server, error) {
148149
data, err := ParseSSHCommand(cmd)
149150
if err != nil {

internal/adapters/ui/status_bar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
)
2121

2222
func DefaultStatusText() string {
23-
return "[white]↑↓[-] Navigate • [white]Enter[-] SSH • [white]c[-] Copy SSH • [white]a[-] Add • [white]v[-] Add from SSH • [white]e[-] Edit • [white]g[-] Ping • [white]d[-] Delete • [white]p[-] Pin/Unpin • [white]/[-] Search • [white]q[-] Quit"
23+
return "[white]↑↓[-] Navigate • [white]Enter[-] SSH • [white]c[-] Copy SSH • [white]v[-] Paste SSH • [white]a[-] Add • [white]e[-] Edit • [white]g[-] Ping • [white]d[-] Delete • [white]p[-] Pin/Unpin • [white]/[-] Search • [white]q[-] Quit"
2424
}
2525

2626
func NewStatusBar() *tview.TextView {

0 commit comments

Comments
 (0)