forked from go-python/gopy
/
main.go
49 lines (40 loc) · 823 Bytes
/
main.go
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
// Copyright 2015 The go-python Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"log"
"os"
"github.com/gonuts/commander"
"github.com/gonuts/flag"
)
const (
defaultPyVersion = "py2"
)
var (
app *commander.Command
)
func init() {
app = &commander.Command{
UsageLine: "gopy",
Subcommands: []*commander.Command{
gopyMakeCmdGen(),
gopyMakeCmdBind(),
},
Flag: *flag.NewFlagSet("gopy", flag.ExitOnError),
}
}
func main() {
err := app.Flag.Parse(os.Args[1:])
if err != nil {
log.Printf("error parsing flags: %v\n", err)
os.Exit(1)
}
args := app.Flag.Args()
err = app.Dispatch(args)
if err != nil {
log.Printf("error dispatching command: %v\n", err)
os.Exit(1)
}
os.Exit(0)
}