diff options
| author | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-01-25 15:37:20 +0100 |
|---|---|---|
| committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2015-01-25 15:37:20 +0100 |
| commit | 792784d07fa159ff3a243271f4633f02efe500b3 (patch) | |
| tree | a3be127fdf9f4e3ad409c9cdd6a6540b2679e284 /main.go | |
| parent | Initial commit (diff) | |
| download | gitlab-runner-792784d07fa159ff3a243271f4633f02efe500b3.tar.gz | |
WIP
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 66 |
1 files changed, 2 insertions, 64 deletions
@@ -1,71 +1,9 @@ package main import ( - "os" - "path" - "fmt" - - "github.com/codegangsta/cli" - log "github.com/Sirupsen/logrus" + "github.com/ayufan/gitlab-ci-multi-runner/src" ) func main() { - app := cli.NewApp() - app.Name = path.Base(os.Args[0]) - app.Usage = "a GitLab-CI Multi Runner" - app.Version = "0.1.0" - app.Author = "" - app.Email = "" - - app.Flags = []cli.Flag{ - cli.BoolFlag{ - Name: "debug", - Usage: "debug mode", - EnvVar: "DEBUG", - }, - cli.StringFlag{ - Name: "log-level, l", - Value: "info", - Usage: fmt.Sprintf("Log level (options: debug, info, warn, error, fatal, panic)"), - }, - } - - // logs - app.Before = func(c *cli.Context) error { - log.SetOutput(os.Stderr) - level, err := log.ParseLevel(c.String("log-level")) - if err != nil { - log.Fatalf(err.Error()) - } - log.SetLevel(level) - - // If a log level wasn't specified and we are running in debug mode, - // enforce log-level=debug. - if !c.IsSet("log-level") && !c.IsSet("l") && c.Bool("debug") { - log.SetLevel(log.DebugLevel) - } - - return nil - } - - app.Commands = []cli.Command{ - { - Name: "run", - ShortName: "r", - Usage: "start single runner", - Flags: []cli.Flag{flToken, flURL}, - Action: run, - }, - { - Name: "setup", - ShortName: "s", - Usage: "setup a new runner", - Flags: []cli.Flag{flRegistrationToken, flURL, flHostname}, - Action: setup, - }, - } - - if err := app.Run(os.Args); err != nil { - log.Fatal(err) - } + src.Main() } |
