Improve terminal handling and make server arg more helpful

This commit is contained in:
2026-03-26 14:03:09 +01:00
parent cd56349517
commit 24f1fd0477
2 changed files with 38 additions and 10 deletions

11
main.go
View File

@@ -253,6 +253,17 @@ Debug output goes to stderr (kubectl surfaces this to the terminal):
return fmt.Errorf("--server is required")
}
// prepend https if no scheme is given, for user convenience
if !strings.Contains(server, "://") {
server = "https://" + server
}
// append port 8443 if no port is given
parts := strings.Split(server, ":")
if len(parts) == 2 {
server += ":8443"
}
logf := func(format string, a ...interface{}) {
if debugFlag {
fmt.Fprintf(os.Stderr, "[ward] "+format+"\n", a...)