feat: add short ID column to list, improve connect error with hint
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user