This repository was archived by the owner on Mar 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathearthkit.go
More file actions
59 lines (52 loc) · 1.45 KB
/
earthkit.go
File metadata and controls
59 lines (52 loc) · 1.45 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"flag"
"fmt"
"github.com/opslabjpl/earthkit-cli/commands"
"github.com/opslabjpl/earthkit-cli/config"
"os"
"runtime"
"strings"
)
var entryPoints = map[string]func([]string){
"init": commands.InitCommand,
"push": commands.PushCommand,
"pull": commands.PullCommand,
"cloudrun": commands.CloudRunCommand,
"cloudrun-status": commands.CloudRunStatusCommand,
"run": commands.RunCommand,
"fileset-delete": commands.FilesetDeleteCommand,
"filesets": commands.FilesetsCommand,
"clone": commands.CloneCommand,
"workspace": commands.WorkspaceCommand,
"pool-create": commands.PoolCreateCommand,
"pool-list": commands.PoolListCommand,
"pool-kill": commands.PoolKillCommand,
"pool-stop": commands.PoolStopCommand,
}
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
config.Load()
cmdOpts := make([]string, len(entryPoints))
i := 0
for k, _ := range entryPoints {
cmdOpts[i] = k
i++
}
if (flag.NArg() < 1) || (flag.Arg(0) == "help") {
fmt.Println("Usage: ", os.Args[0], "-[options] cmd")
fmt.Println("Commands: ", strings.Join(cmdOpts, "|"))
fmt.Println("Options:")
flag.PrintDefaults()
return
}
var subCommand = flag.Arg(0)
var subCommandArgs = flag.Args()[1:]
cmd, ok := entryPoints[subCommand]
if !ok {
fmt.Println("Usage: ", os.Args[0], strings.Join(cmdOpts, "|"))
flag.PrintDefaults()
return
}
cmd(subCommandArgs)
}