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

89 lines
1.8 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"
2018-03-01 20:23:03 +01:00
"github.com/drone/drone-cli/drone/autoscale"
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"
2018-05-14 20:03:05 +02:00
"github.com/drone/drone-cli/drone/jsonnet"
2018-02-21 23:29:11 +01:00
"github.com/drone/drone-cli/drone/log"
2017-05-15 13:59:26 +02:00
"github.com/drone/drone-cli/drone/registry"
"github.com/drone/drone-cli/drone/repo"
"github.com/drone/drone-cli/drone/secret"
2018-02-14 22:06:05 +01:00
"github.com/drone/drone-cli/drone/server"
2017-05-15 13:59:26 +02:00
"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",
},
2018-02-14 22:06:05 +01:00
2015-02-13 09:23:01 +01:00
cli.StringFlag{
Name: "s, server",
2018-02-14 22:06:05 +01:00
Usage: "server address",
2015-02-13 09:23:01 +01:00
EnvVar: "DRONE_SERVER",
},
2018-02-14 22:06:05 +01:00
cli.StringFlag{
Name: "autoscaler",
Usage: "autoscaler address",
EnvVar: "DRONE_AUTOSCALER",
},
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,
2018-02-20 20:43:09 +01:00
log.Command,
2017-05-15 13:59:26 +02:00
deploy.Command,
exec.Command,
info.Command,
registry.Command,
secret.Command,
repo.Command,
user.Command,
2018-02-14 22:06:05 +01:00
server.Command,
2018-03-01 20:23:03 +01:00
autoscale.Command,
2018-05-14 20:03:05 +02:00
jsonnet.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
}