-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmarcel.go
More file actions
35 lines (29 loc) · 715 Bytes
/
marcel.go
File metadata and controls
35 lines (29 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"log"
"os"
"strings"
"github.com/dgageot/marcel/config"
)
func marcel(args []string) error {
switch {
case len(args) == 1 && args[0] == "ip":
return config.PrintIP()
case len(args) == 2 && args[0] == "use" && args[1] == "local":
return config.UseLocal()
case len(args) == 2 && args[0] == "use" && !strings.HasPrefix(args[1], "tcp://"):
return config.UseMachine(args[1])
case len(args) == 2 && args[0] == "use":
return config.UseUrl(args[1])
case len(args) == 3 && args[0] == "use":
return config.UseUrlWithTls(args[1], args[2])
default:
return run(executable(args))
}
return nil
}
func main() {
if err := marcel(os.Args[1:]); err != nil {
log.Fatal(err)
}
}