1
0
mirror of https://github.com/drone/drone-cli.git synced 2024-11-26 06:07:05 +01:00
drone-cli/drone/main.go

75 lines
1.5 KiB
Go
Raw Normal View History

2015-02-13 09:23:01 +01:00
package main
import (
2017-05-15 13:59:26 +02:00
"fmt"
2015-02-13 09:23:01 +01:00
"os"
2017-05-15 13:59:26 +02:00
"github.com/drone/drone-cli/drone/build"
"github.com/drone/drone-cli/drone/deploy"
"github.com/drone/drone-cli/drone/exec"
"github.com/drone/drone-cli/drone/info"
"github.com/drone/drone-cli/drone/registry"
"github.com/drone/drone-cli/drone/repo"
"github.com/drone/drone-cli/drone/secret"
"github.com/drone/drone-cli/drone/user"
2016-05-25 18:43:33 +02:00
_ "github.com/joho/godotenv/autoload"
2017-05-15 13:59:26 +02:00
"github.com/urfave/cli"
2015-02-13 09:23:01 +01:00
)
2017-05-15 13:59:26 +02:00
// drone version number
var version string
2016-05-25 18:43:33 +02:00
2017-05-15 13:59:26 +02:00
func main() {
2015-02-13 09:23:01 +01:00
app := cli.NewApp()
app.Name = "drone"
2017-05-15 13:59:26 +02:00
app.Version = version
2015-02-13 09:23:01 +01:00
app.Usage = "command line utility"
app.EnableBashCompletion = true
2015-02-13 09:23:01 +01:00
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "t, token",
Usage: "server auth token",
EnvVar: "DRONE_TOKEN",
},
cli.StringFlag{
Name: "s, server",
Usage: "server location",
EnvVar: "DRONE_SERVER",
},
2017-05-15 13:59:26 +02:00
cli.BoolFlag{
Name: "skip-verify",
Usage: "skip ssl verfification",
EnvVar: "DRONE_SKIP_VERIFY",
Hidden: true,
},
cli.StringFlag{
Name: "socks-proxy",
Usage: "socks proxy address",
EnvVar: "SOCKS_PROXY",
Hidden: true,
},
cli.BoolFlag{
Name: "socks-proxy-off",
Usage: "socks proxy ignored",
EnvVar: "SOCKS_PROXY_OFF",
Hidden: true,
},
2015-02-13 09:23:01 +01:00
}
app.Commands = []cli.Command{
2017-05-15 13:59:26 +02:00
build.Command,
deploy.Command,
exec.Command,
info.Command,
registry.Command,
secret.Command,
repo.Command,
user.Command,
2015-02-13 09:23:01 +01:00
}
2016-05-25 18:43:33 +02:00
if err := app.Run(os.Args); err != nil {
2017-05-15 13:59:26 +02:00
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
2016-05-25 18:43:33 +02:00
}
2015-02-13 09:23:01 +01:00
}