-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Copy pathmain.go
72 lines (67 loc) · 1.41 KB
/
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"os"
"github.com/smartcontractkit/chainlink/cmd"
"github.com/smartcontractkit/chainlink/store"
"github.com/urfave/cli"
)
func main() {
Run(NewProductionClient(), os.Args...)
}
func Run(client *cmd.Client, args ...string) {
app := cli.NewApp()
app.Usage = "CLI for Chainlink"
app.Version = store.Version
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "json, j",
Usage: "json output as opposed to table",
},
}
app.Before = func(c *cli.Context) error {
if c.Bool("json") {
client.Renderer = cmd.RendererJSON{os.Stdout}
}
return nil
}
app.Commands = []cli.Command{
{
Name: "node",
Aliases: []string{"n"},
Flags: []cli.Flag{
cli.StringFlag{
Name: "password, p",
Usage: "password for the node's account",
},
cli.BoolFlag{
Name: "debug, d",
Usage: "set logger level to debug",
},
},
Usage: "Run the chainlink node",
Action: client.RunNode,
},
{
Name: "jobs",
Aliases: []string{"j"},
Usage: "Get all jobs",
Action: client.GetJobs,
},
{
Name: "show",
Aliases: []string{"s"},
Usage: "Show a specific job",
Action: client.ShowJob,
},
}
app.Run(args)
}
func NewProductionClient() *cmd.Client {
return &cmd.Client{
cmd.RendererTable{os.Stdout},
store.NewConfig(),
cmd.ChainlinkAppFactory{},
cmd.TerminalAuthenticator{cmd.PasswordPrompter{}, os.Exit},
cmd.ChainlinkRunner{},
}
}