mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-06-28 16:26:48 +00:00
Handle supported operation in main
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
6c9273e582
commit
eee1c23654
@ -3,14 +3,26 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// parse command-line flags
|
// parse command-line flags
|
||||||
argv := os.Args[1:]
|
var op Op
|
||||||
fmt.Printf("%#v\n", argv)
|
op = parseArgs(os.Args[1:])
|
||||||
|
|
||||||
//var op Op
|
switch v := op.(type) {
|
||||||
//op _= parseArgs(argv) // -> DeleteOp RenameOp HelpOp UnrecognizedFlags
|
case ListOp:
|
||||||
|
// TODO implement
|
||||||
|
panic("not implemented")
|
||||||
|
case SwitchOp:
|
||||||
|
// TODO implement
|
||||||
|
panic("not implemented")
|
||||||
|
case UnknownOp:
|
||||||
|
fmt.Printf("error: unsupported operation: %s\n", strings.Join(v.Args, " "))
|
||||||
|
// TODO print --help string
|
||||||
|
os.Exit(1)
|
||||||
|
default:
|
||||||
|
fmt.Printf("internal error: operation type %T not handled", op)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user