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

107 lines
2.4 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"
2018-10-25 01:05:24 +02:00
"github.com/drone/drone-cli/drone/convert"
2018-08-07 01:29:03 +02:00
"github.com/drone/drone-cli/drone/cron"
"github.com/drone/drone-cli/drone/encrypt"
2017-05-15 13:59:26 +02:00
"github.com/drone/drone-cli/drone/exec"
2018-09-14 03:41:12 +02:00
"github.com/drone/drone-cli/drone/format"
2017-05-15 13:59:26 +02:00
"github.com/drone/drone-cli/drone/info"
2018-05-14 20:03:05 +02:00
"github.com/drone/drone-cli/drone/jsonnet"
2018-10-25 01:05:24 +02:00
"github.com/drone/drone-cli/drone/lint"
2018-02-21 23:29:11 +01:00
"github.com/drone/drone-cli/drone/log"
2019-04-15 17:24:03 +02:00
"github.com/drone/drone-cli/drone/orgsecret"
2018-09-01 03:24:14 +02:00
"github.com/drone/drone-cli/drone/plugins"
2018-10-22 06:42:22 +02:00
"github.com/drone/drone-cli/drone/queue"
2017-05-15 13:59:26 +02:00
"github.com/drone/drone-cli/drone/repo"
2018-10-21 21:18:43 +02:00
"github.com/drone/drone-cli/drone/secret"
2018-02-14 22:06:05 +01:00
"github.com/drone/drone-cli/drone/server"
2018-09-14 03:41:12 +02:00
"github.com/drone/drone-cli/drone/sign"
2019-02-20 06:29:51 +01:00
"github.com/drone/drone-cli/drone/starlark"
2021-05-21 15:03:48 +02:00
"github.com/drone/drone-cli/drone/template"
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",
2021-01-21 09:12:47 +01:00
Usage: "skip ssl verification",
2017-05-15 13:59:26 +02:00
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-08-07 01:29:03 +02:00
cron.Command,
2018-02-20 20:43:09 +01:00
log.Command,
2018-08-07 01:29:03 +02:00
encrypt.Command,
2017-05-15 13:59:26 +02:00
exec.Command,
info.Command,
repo.Command,
user.Command,
2018-10-21 21:18:43 +02:00
secret.Command,
2018-02-14 22:06:05 +01:00
server.Command,
2018-10-22 06:42:22 +02:00
queue.Command,
2019-04-15 17:24:03 +02:00
orgsecret.Command,
2018-03-01 20:23:03 +01:00
autoscale.Command,
2018-09-14 03:41:12 +02:00
format.Command,
2018-10-25 01:05:24 +02:00
convert.Command,
lint.Command,
2018-09-14 03:41:12 +02:00
sign.Command,
2018-05-14 20:03:05 +02:00
jsonnet.Command,
2019-02-20 06:29:51 +01:00
starlark.Command,
2018-09-01 03:24:14 +02:00
plugins.Command,
2021-05-21 15:03:48 +02:00
template.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
}