summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2015-01-25 15:37:20 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2015-01-25 15:37:20 +0100
commit792784d07fa159ff3a243271f4633f02efe500b3 (patch)
treea3be127fdf9f4e3ad409c9cdd6a6540b2679e284 /main.go
parentInitial commit (diff)
downloadgitlab-runner-792784d07fa159ff3a243271f4633f02efe500b3.tar.gz
WIP
Diffstat (limited to 'main.go')
-rw-r--r--main.go66
1 files changed, 2 insertions, 64 deletions
diff --git a/main.go b/main.go
index b6943c32..ddd927cd 100644
--- a/main.go
+++ b/main.go
@@ -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()
}