mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-06-05 17:08:50 +00:00
move commands to subfolders
This commit is contained in:
parent
cc530301fe
commit
45e67985a9
43 changed files with 220 additions and 146 deletions
|
@ -24,8 +24,8 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AgentCmd is the exported command for starting the drone agent.
|
// Command exports the agent command.
|
||||||
var AgentCmd = cli.Command{
|
var Command = cli.Command{
|
||||||
Name: "agent",
|
Name: "agent",
|
||||||
Usage: "starts the drone agent",
|
Usage: "starts the drone agent",
|
||||||
Action: loop,
|
Action: loop,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import "github.com/urfave/cli"
|
import "github.com/urfave/cli"
|
||||||
|
|
||||||
var buildCmd = cli.Command{
|
// Command exports the build command set.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "build",
|
Name: "build",
|
||||||
Usage: "manage builds",
|
Usage: "manage builds",
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ var buildApproveCmd = cli.Command{
|
||||||
|
|
||||||
func buildApprove(c *cli.Context) (err error) {
|
func buildApprove(c *cli.Context) (err error) {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -24,7 +25,7 @@ func buildApprove(c *cli.Context) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ var buildDeclineCmd = cli.Command{
|
||||||
|
|
||||||
func buildDecline(c *cli.Context) (err error) {
|
func buildDecline(c *cli.Context) (err error) {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -24,7 +25,7 @@ func buildDecline(c *cli.Context) (err error) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,10 +1,11 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,13 +24,13 @@ var buildInfoCmd = cli.Command{
|
||||||
|
|
||||||
func buildInfo(c *cli.Context) error {
|
func buildInfo(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
buildArg := c.Args().Get(1)
|
buildArg := c.Args().Get(1)
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -27,12 +28,12 @@ var buildLastCmd = cli.Command{
|
||||||
|
|
||||||
func buildLast(c *cli.Context) error {
|
func buildLast(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,12 +40,12 @@ var buildListCmd = cli.Command{
|
||||||
|
|
||||||
func buildList(c *cli.Context) error {
|
func buildList(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
@ -6,6 +6,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"github.com/cncd/pipeline/pipeline/rpc"
|
"github.com/cncd/pipeline/pipeline/rpc"
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,12 +22,12 @@ func buildLogsDisabled(c *cli.Context) error {
|
||||||
|
|
||||||
func buildLogs(c *cli.Context) error {
|
func buildLogs(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,10 +1,11 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -23,7 +24,7 @@ var buildQueueCmd = cli.Command{
|
||||||
|
|
||||||
func buildQueue(c *cli.Context) error {
|
func buildQueue(c *cli.Context) error {
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -26,12 +27,12 @@ var buildStartCmd = cli.Command{
|
||||||
|
|
||||||
func buildStart(c *cli.Context) (err error) {
|
func buildStart(c *cli.Context) (err error) {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -52,7 +53,7 @@ func buildStart(c *cli.Context) (err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
params := parseKVPairs(c.StringSlice("param"))
|
params := internal.ParseKeyPair(c.StringSlice("param"))
|
||||||
|
|
||||||
var build *model.Build
|
var build *model.Build
|
||||||
if c.Bool("fork") {
|
if c.Bool("fork") {
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,7 +16,7 @@ var buildStopCmd = cli.Command{
|
||||||
|
|
||||||
func buildStop(c *cli.Context) (err error) {
|
func buildStop(c *cli.Context) (err error) {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -28,7 +29,7 @@ func buildStop(c *cli.Context) (err error) {
|
||||||
job = 1
|
job = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package deploy
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -6,11 +6,14 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var deployCmd = cli.Command{
|
// Command exports the deploy command.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "deploy",
|
Name: "deploy",
|
||||||
Usage: "deploy code",
|
Usage: "deploy code",
|
||||||
Action: deploy,
|
Action: deploy,
|
||||||
|
@ -44,12 +47,12 @@ var deployCmd = cli.Command{
|
||||||
|
|
||||||
func deploy(c *cli.Context) error {
|
func deploy(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -62,9 +65,9 @@ func deploy(c *cli.Context) error {
|
||||||
var number int
|
var number int
|
||||||
if buildArg == "last" {
|
if buildArg == "last" {
|
||||||
// Fetch the build number from the last build
|
// Fetch the build number from the last build
|
||||||
builds, err := client.BuildList(owner, name)
|
builds, berr := client.BuildList(owner, name)
|
||||||
if err != nil {
|
if berr != nil {
|
||||||
return err
|
return berr
|
||||||
}
|
}
|
||||||
for _, build := range builds {
|
for _, build := range builds {
|
||||||
if branch != "" && build.Branch != branch {
|
if branch != "" && build.Branch != branch {
|
||||||
|
@ -95,7 +98,7 @@ func deploy(c *cli.Context) error {
|
||||||
return fmt.Errorf("Please specify the target environment (ie production)")
|
return fmt.Errorf("Please specify the target environment (ie production)")
|
||||||
}
|
}
|
||||||
|
|
||||||
params := parseKVPairs(c.StringSlice("param"))
|
params := internal.ParseKeyPair(c.StringSlice("param"))
|
||||||
|
|
||||||
deploy, err := client.Deploy(owner, name, number, env, params)
|
deploy, err := client.Deploy(owner, name, number, env, params)
|
||||||
if err != nil {
|
if err != nil {
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package exec
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
@ -23,7 +23,8 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var execCmd = cli.Command{
|
// Command exports the exec command.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "exec",
|
Name: "exec",
|
||||||
Usage: "execute a local build",
|
Usage: "execute a local build",
|
||||||
Action: func(c *cli.Context) {
|
Action: func(c *cli.Context) {
|
|
@ -1,27 +1,31 @@
|
||||||
package main
|
package info
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var infoCmd = cli.Command{
|
// Command exports the info command.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "info",
|
Name: "info",
|
||||||
Usage: "show information about the current user",
|
Usage: "show information about the current user",
|
||||||
Action: info,
|
Action: info,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "format",
|
Name: "format",
|
||||||
Usage: "format output",
|
Usage: "format output",
|
||||||
Value: tmplUserInfo,
|
Value: tmplInfo,
|
||||||
|
Hidden: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func info(c *cli.Context) error {
|
func info(c *cli.Context) error {
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package internal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
@ -13,7 +13,8 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newClient(c *cli.Context) (client.Client, error) {
|
// NewClient returns a new client from the CLI context.
|
||||||
|
func NewClient(c *cli.Context) (client.Client, error) {
|
||||||
var token = c.GlobalString("token")
|
var token = c.GlobalString("token")
|
||||||
var server = strings.TrimRight(c.GlobalString("server"), "/")
|
var server = strings.TrimRight(c.GlobalString("server"), "/")
|
||||||
|
|
||||||
|
@ -34,7 +35,8 @@ func newClient(c *cli.Context) (client.Client, error) {
|
||||||
return client.NewClientTokenTLS(server, token, tlsConfig)
|
return client.NewClientTokenTLS(server, token, tlsConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseRepo(str string) (user, repo string, err error) {
|
// ParseRepo parses the repository owner and name from a string.
|
||||||
|
func ParseRepo(str string) (user, repo string, err error) {
|
||||||
var parts = strings.Split(str, "/")
|
var parts = strings.Split(str, "/")
|
||||||
if len(parts) != 2 {
|
if len(parts) != 2 {
|
||||||
err = fmt.Errorf("Error: Invalid or missing repository. eg octocat/hello-world.")
|
err = fmt.Errorf("Error: Invalid or missing repository. eg octocat/hello-world.")
|
||||||
|
@ -62,7 +64,8 @@ func stringInSlice(a string, list []string) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseKVPairs(p []string) map[string]string {
|
// ParseKeyPair parses a key=value pair.
|
||||||
|
func ParseKeyPair(p []string) map[string]string {
|
||||||
params := map[string]string{}
|
params := map[string]string{}
|
||||||
for _, i := range p {
|
for _, i := range p {
|
||||||
parts := strings.Split(i, "=")
|
parts := strings.Split(i, "=")
|
|
@ -1,10 +1,10 @@
|
||||||
package main
|
package internal
|
||||||
|
|
||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
func Test_parseKVPairs(t *testing.T) {
|
func TestParseKeyPair(t *testing.T) {
|
||||||
s := []string{"FOO=bar", "BAR=", "INVALID"}
|
s := []string{"FOO=bar", "BAR=", "INVALID"}
|
||||||
p := parseKVPairs(s)
|
p := ParseKeyPair(s)
|
||||||
if p["FOO"] != "bar" {
|
if p["FOO"] != "bar" {
|
||||||
t.Errorf("Wanted %q, got %q.", "bar", p["FOO"])
|
t.Errorf("Wanted %q, got %q.", "bar", p["FOO"])
|
||||||
}
|
}
|
|
@ -5,6 +5,15 @@ import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/drone/drone/drone/agent"
|
"github.com/drone/drone/drone/agent"
|
||||||
|
"github.com/drone/drone/drone/build"
|
||||||
|
"github.com/drone/drone/drone/deploy"
|
||||||
|
"github.com/drone/drone/drone/exec"
|
||||||
|
"github.com/drone/drone/drone/info"
|
||||||
|
"github.com/drone/drone/drone/registry"
|
||||||
|
"github.com/drone/drone/drone/repo"
|
||||||
|
"github.com/drone/drone/drone/secret"
|
||||||
|
"github.com/drone/drone/drone/server"
|
||||||
|
"github.com/drone/drone/drone/user"
|
||||||
"github.com/drone/drone/version"
|
"github.com/drone/drone/version"
|
||||||
|
|
||||||
"github.com/ianschenck/envflag"
|
"github.com/ianschenck/envflag"
|
||||||
|
@ -32,16 +41,16 @@ func main() {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
app.Commands = []cli.Command{
|
app.Commands = []cli.Command{
|
||||||
agent.AgentCmd,
|
agent.Command,
|
||||||
buildCmd,
|
build.Command,
|
||||||
deployCmd,
|
deploy.Command,
|
||||||
execCmd,
|
exec.Command,
|
||||||
infoCmd,
|
info.Command,
|
||||||
registryCmd,
|
registry.Command,
|
||||||
secretCmd,
|
secret.Command,
|
||||||
serverCmd,
|
server.Command,
|
||||||
repoCmd,
|
repo.Command,
|
||||||
userCmd,
|
user.Command,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package registry
|
||||||
|
|
||||||
import "github.com/urfave/cli"
|
import "github.com/urfave/cli"
|
||||||
|
|
||||||
var registryCmd = cli.Command{
|
// Command exports the registry command set.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "registry",
|
Name: "registry",
|
||||||
Usage: "manage registries",
|
Usage: "manage registries",
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
|
@ -1,10 +1,12 @@
|
||||||
package main
|
package registry
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,11 +45,11 @@ func registryCreate(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -58,9 +60,9 @@ func registryCreate(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(registry.Password, "@") {
|
if strings.HasPrefix(registry.Password, "@") {
|
||||||
path := strings.TrimPrefix(registry.Password, "@")
|
path := strings.TrimPrefix(registry.Password, "@")
|
||||||
out, err := ioutil.ReadFile(path)
|
out, ferr := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if ferr != nil {
|
||||||
return err
|
return ferr
|
||||||
}
|
}
|
||||||
registry.Password = string(out)
|
registry.Password = string(out)
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
package main
|
package registry
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,11 +41,11 @@ func registryInfo(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
package main
|
package registry
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var registryListCmd = cli.Command{
|
var registryListCmd = cli.Command{
|
||||||
|
@ -33,11 +35,11 @@ func registryList(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,6 +1,10 @@
|
||||||
package main
|
package registry
|
||||||
|
|
||||||
import "github.com/urfave/cli"
|
import (
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
|
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
)
|
||||||
|
|
||||||
var registryDeleteCmd = cli.Command{
|
var registryDeleteCmd = cli.Command{
|
||||||
Name: "rm",
|
Name: "rm",
|
||||||
|
@ -27,11 +31,11 @@ func registryDelete(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
package main
|
package registry
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -43,11 +45,11 @@ func registryUpdate(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -58,9 +60,9 @@ func registryUpdate(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(registry.Password, "@") {
|
if strings.HasPrefix(registry.Password, "@") {
|
||||||
path := strings.TrimPrefix(registry.Password, "@")
|
path := strings.TrimPrefix(registry.Password, "@")
|
||||||
out, err := ioutil.ReadFile(path)
|
out, ferr := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if ferr != nil {
|
||||||
return err
|
return ferr
|
||||||
}
|
}
|
||||||
registry.Password = string(out)
|
registry.Password = string(out)
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package repo
|
||||||
|
|
||||||
import "github.com/urfave/cli"
|
import "github.com/urfave/cli"
|
||||||
|
|
||||||
var repoCmd = cli.Command{
|
// Command exports the repository command.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "repo",
|
Name: "repo",
|
||||||
Usage: "manage repositories",
|
Usage: "manage repositories",
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,12 +15,12 @@ var repoAddCmd = cli.Command{
|
||||||
|
|
||||||
func repoAdd(c *cli.Context) error {
|
func repoAdd(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,12 +15,12 @@ var repoChownCmd = cli.Command{
|
||||||
|
|
||||||
func repoChown(c *cli.Context) error {
|
func repoChown(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -22,12 +23,12 @@ var repoInfoCmd = cli.Command{
|
||||||
|
|
||||||
func repoInfo(c *cli.Context) error {
|
func repoInfo(c *cli.Context) error {
|
||||||
arg := c.Args().First()
|
arg := c.Args().First()
|
||||||
owner, name, err := parseRepo(arg)
|
owner, name, err := internal.ParseRepo(arg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ var repoListCmd = cli.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func repoList(c *cli.Context) error {
|
func repoList(c *cli.Context) error {
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
package main
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,11 +13,11 @@ var repoRepairCmd = cli.Command{
|
||||||
|
|
||||||
func repoRepair(c *cli.Context) error {
|
func repoRepair(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,12 +15,12 @@ var repoRemoveCmd = cli.Command{
|
||||||
|
|
||||||
func repoRemove(c *cli.Context) error {
|
func repoRemove(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,9 +1,10 @@
|
||||||
package main
|
package repo
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
@ -34,12 +35,12 @@ var repoUpdateCmd = cli.Command{
|
||||||
|
|
||||||
func repoUpdate(c *cli.Context) error {
|
func repoUpdate(c *cli.Context) error {
|
||||||
repo := c.Args().First()
|
repo := c.Args().First()
|
||||||
owner, name, err := parseRepo(repo)
|
owner, name, err := internal.ParseRepo(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package secret
|
||||||
|
|
||||||
import "github.com/urfave/cli"
|
import "github.com/urfave/cli"
|
||||||
|
|
||||||
var secretCmd = cli.Command{
|
// Command exports the secret command.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "secret",
|
Name: "secret",
|
||||||
Usage: "manage secrets",
|
Usage: "manage secrets",
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
|
@ -1,10 +1,12 @@
|
||||||
package main
|
package secret
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -41,11 +43,11 @@ func secretCreate(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -60,9 +62,9 @@ func secretCreate(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(secret.Value, "@") {
|
if strings.HasPrefix(secret.Value, "@") {
|
||||||
path := strings.TrimPrefix(secret.Value, "@")
|
path := strings.TrimPrefix(secret.Value, "@")
|
||||||
out, err := ioutil.ReadFile(path)
|
out, ferr := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if ferr != nil {
|
||||||
return err
|
return ferr
|
||||||
}
|
}
|
||||||
secret.Value = string(out)
|
secret.Value = string(out)
|
||||||
}
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
package main
|
package secret
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var secretInfoCmd = cli.Command{
|
var secretInfoCmd = cli.Command{
|
||||||
|
@ -38,11 +40,11 @@ func secretInfo(c *cli.Context) error {
|
||||||
if repoName == "" {
|
if repoName == "" {
|
||||||
repoName = c.Args().First()
|
repoName = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(repoName)
|
owner, name, err := internal.ParseRepo(repoName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package secret
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"html/template"
|
"html/template"
|
||||||
|
@ -6,6 +6,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var secretListCmd = cli.Command{
|
var secretListCmd = cli.Command{
|
||||||
|
@ -34,11 +36,11 @@ func secretList(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,6 +1,10 @@
|
||||||
package main
|
package secret
|
||||||
|
|
||||||
import "github.com/urfave/cli"
|
import (
|
||||||
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
|
)
|
||||||
|
|
||||||
var secretDeleteCmd = cli.Command{
|
var secretDeleteCmd = cli.Command{
|
||||||
Name: "rm",
|
Name: "rm",
|
||||||
|
@ -26,11 +30,11 @@ func secretDelete(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
package main
|
package secret
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -41,11 +43,11 @@ func secretUpdate(c *cli.Context) error {
|
||||||
if reponame == "" {
|
if reponame == "" {
|
||||||
reponame = c.Args().First()
|
reponame = c.Args().First()
|
||||||
}
|
}
|
||||||
owner, name, err := parseRepo(reponame)
|
owner, name, err := internal.ParseRepo(reponame)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -57,9 +59,9 @@ func secretUpdate(c *cli.Context) error {
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(secret.Value, "@") {
|
if strings.HasPrefix(secret.Value, "@") {
|
||||||
path := strings.TrimPrefix(secret.Value, "@")
|
path := strings.TrimPrefix(secret.Value, "@")
|
||||||
out, err := ioutil.ReadFile(path)
|
out, ferr := ioutil.ReadFile(path)
|
||||||
if err != nil {
|
if ferr != nil {
|
||||||
return err
|
return ferr
|
||||||
}
|
}
|
||||||
secret.Value = string(out)
|
secret.Value = string(out)
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -12,7 +12,8 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var serverCmd = cli.Command{
|
// Command exports the server command.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "server",
|
Name: "server",
|
||||||
Usage: "starts the drone server daemon",
|
Usage: "starts the drone server daemon",
|
||||||
Action: server,
|
Action: server,
|
|
@ -1,8 +1,9 @@
|
||||||
package main
|
package user
|
||||||
|
|
||||||
import "github.com/urfave/cli"
|
import "github.com/urfave/cli"
|
||||||
|
|
||||||
var userCmd = cli.Command{
|
// Command exports the user command set.
|
||||||
|
var Command = cli.Command{
|
||||||
Name: "user",
|
Name: "user",
|
||||||
Usage: "manage users",
|
Usage: "manage users",
|
||||||
Subcommands: []cli.Command{
|
Subcommands: []cli.Command{
|
|
@ -1,10 +1,12 @@
|
||||||
package main
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/drone/drone/model"
|
"github.com/drone/drone/model"
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var userAddCmd = cli.Command{
|
var userAddCmd = cli.Command{
|
||||||
|
@ -16,7 +18,7 @@ var userAddCmd = cli.Command{
|
||||||
func userAdd(c *cli.Context) error {
|
func userAdd(c *cli.Context) error {
|
||||||
login := c.Args().First()
|
login := c.Args().First()
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package main
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -6,6 +6,8 @@ import (
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var userInfoCmd = cli.Command{
|
var userInfoCmd = cli.Command{
|
||||||
|
@ -22,7 +24,7 @@ var userInfoCmd = cli.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func userInfo(c *cli.Context) error {
|
func userInfo(c *cli.Context) error {
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,10 +1,12 @@
|
||||||
package main
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var userListCmd = cli.Command{
|
var userListCmd = cli.Command{
|
||||||
|
@ -21,7 +23,7 @@ var userListCmd = cli.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
func userList(c *cli.Context) error {
|
func userList(c *cli.Context) error {
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
|
@ -1,9 +1,11 @@
|
||||||
package main
|
package user
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
|
|
||||||
|
"github.com/drone/drone/drone/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var userRemoveCmd = cli.Command{
|
var userRemoveCmd = cli.Command{
|
||||||
|
@ -15,7 +17,7 @@ var userRemoveCmd = cli.Command{
|
||||||
func userRemove(c *cli.Context) error {
|
func userRemove(c *cli.Context) error {
|
||||||
login := c.Args().First()
|
login := c.Args().First()
|
||||||
|
|
||||||
client, err := newClient(c)
|
client, err := internal.NewClient(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
Loading…
Reference in a new issue