From 513b07997757f8227ab78f93f0b2ad8068fc9823 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Wed, 20 Feb 2019 16:59:11 -0800 Subject: [PATCH] print machine account token --- Gopkg.lock | 4 ++-- drone/user/user_add.go | 8 ++++++++ vendor/github.com/drone/drone-go/NOTICE | 6 ++++++ vendor/github.com/drone/drone-go/drone/types.go | 8 +++++--- 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 vendor/github.com/drone/drone-go/NOTICE diff --git a/Gopkg.lock b/Gopkg.lock index 8a7c6e3..5a510c3 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -68,7 +68,6 @@ version = "v0.3.3" [[projects]] - branch = "master" name = "github.com/drone/drone-go" packages = [ "drone", @@ -79,7 +78,8 @@ "plugin/registry", "plugin/secret" ] - revision = "1354e27647f2efee29b63dcd9cc561fafb4c51c1" + revision = "b1b8a8f8f28e6beecb78e7c6fa95a26ccc040b26" + version = "v1.0.1" [[projects]] branch = "master" diff --git a/drone/user/user_add.go b/drone/user/user_add.go index 7fe8dfe..4e940d2 100644 --- a/drone/user/user_add.go +++ b/drone/user/user_add.go @@ -23,6 +23,10 @@ var userAddCmd = cli.Command{ Name: "machine", Usage: "machine account", }, + cli.BoolFlag{ + Name: "token", + Usage: "api token", + }, }, } @@ -38,11 +42,15 @@ func userAdd(c *cli.Context) error { Login: login, Admin: c.Bool("admin"), Machine: c.Bool("machine"), + Token: c.String("token"), } user, err := client.UserCreate(in) if err != nil { return err } fmt.Printf("Successfully added user %s\n", user.Login) + if user.Token != "" { + fmt.Printf("Generated account token %s\n", user.Token) + } return nil } diff --git a/vendor/github.com/drone/drone-go/NOTICE b/vendor/github.com/drone/drone-go/NOTICE new file mode 100644 index 0000000..6bdd4c4 --- /dev/null +++ b/vendor/github.com/drone/drone-go/NOTICE @@ -0,0 +1,6 @@ +Drone +Copyright 2019 Drone.IO, Inc + +This product includes software developed at Drone.IO, Inc. +(http://drone.io/). + diff --git a/vendor/github.com/drone/drone-go/drone/types.go b/vendor/github.com/drone/drone-go/drone/types.go index 8bbc32a..efebb05 100644 --- a/vendor/github.com/drone/drone-go/drone/types.go +++ b/vendor/github.com/drone/drone-go/drone/types.go @@ -29,13 +29,15 @@ type ( Created int64 `json:"created"` Updated int64 `json:"updated"` LastLogin int64 `json:"last_login"` + Token string `json:"token"` } // UserPatch defines a user patch request. UserPatch struct { - Active *bool `json:"active,omitempty"` - Admin *bool `json:"admin,omitempty"` - Machine *bool `json:"machine,omitempty"` + Active *bool `json:"active,omitempty"` + Admin *bool `json:"admin,omitempty"` + Machine *bool `json:"machine,omitempty"` + Token *string `json:"token,omitempty"` } // Repo represents a repository.