Improve terminal handling and make server arg more helpful
This commit is contained in:
11
main.go
11
main.go
@@ -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...)
|
||||
|
||||
Reference in New Issue
Block a user