feat: add short ID column to list, improve connect error with hint

This commit is contained in:
swanadiva
2026-06-23 14:23:11 +07:00
parent 1869cff590
commit 513492e6ee
2 changed files with 19 additions and 6 deletions
+6 -1
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/exec"
"strings"
"time"
"github.com/spf13/cobra"
@@ -118,7 +119,11 @@ func findHost(ctx context.Context, store storage.Storage, identifier string) (*m
}
// Host not found, provide helpful error
return nil, fmt.Errorf("host '%s' not found. Use 'hostkeeper list' to see available hosts", identifier)
msg := fmt.Sprintf("host '%s' not found. Use 'hostkeeper list' to see available hosts", identifier)
if strings.Contains(identifier, " ") {
msg += fmt.Sprintf("\nHint: if the host name contains spaces, quote it: connect \"%s\"", identifier)
}
return nil, fmt.Errorf("%s", msg)
}
// connectWithNativeSSH uses the system SSH client