agola cmd: check MarkFlagRequired errors
This commit is contained in:
parent
d8a92ba0d1
commit
b849e2c07e
|
@ -49,7 +49,7 @@ type directRunStartOptions struct {
|
|||
var directRunStartOpts directRunStartOptions
|
||||
|
||||
func init() {
|
||||
flags := cmdDirectRunStart.PersistentFlags()
|
||||
flags := cmdDirectRunStart.Flags()
|
||||
|
||||
flags.StringSliceVarP(&directRunStartOpts.statusFilter, "status", "s", nil, "filter runs matching the provided status. This option can be repeated multiple times")
|
||||
flags.StringArrayVarP(&directRunStartOpts.labelFilter, "label", "l", nil, "filter runs matching the provided label. This option can be repeated multiple times, in this case only runs matching all the labels will be returned")
|
||||
|
|
|
@ -47,7 +47,9 @@ func init() {
|
|||
flags.StringVarP(&orgCreateOpts.name, "name", "n", "", "organization name")
|
||||
flags.StringVar(&orgCreateOpts.visibility, "visibility", "public", `organization visibility (public or private)`)
|
||||
|
||||
cmdOrgCreate.MarkFlagRequired("name")
|
||||
if err := cmdOrgCreate.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdOrg.AddCommand(cmdOrgCreate)
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ func init() {
|
|||
|
||||
flags.StringVarP(&orgDeleteOpts.name, "name", "n", "", "organization name")
|
||||
|
||||
cmdOrgDelete.MarkFlagRequired("name")
|
||||
if err := cmdOrgDelete.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdOrg.AddCommand(cmdOrgDelete)
|
||||
}
|
||||
|
|
|
@ -49,8 +49,12 @@ func init() {
|
|||
flags.StringVar(&orgMemberAddOpts.username, "username", "", "user name")
|
||||
flags.StringVarP(&orgMemberAddOpts.role, "role", "r", "member", "member role (owner or member)")
|
||||
|
||||
cmdOrgMemberAdd.MarkFlagRequired("orgname")
|
||||
cmdOrgMemberAdd.MarkFlagRequired("username")
|
||||
if err := cmdOrgMemberAdd.MarkFlagRequired("orgname"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdOrgMemberAdd.MarkFlagRequired("username"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdOrgMember.AddCommand(cmdOrgMemberAdd)
|
||||
}
|
||||
|
|
|
@ -48,7 +48,9 @@ func init() {
|
|||
|
||||
flags.StringVarP(&orgMemberListOpts.orgname, "orgname", "n", "", "organization name")
|
||||
|
||||
cmdOrgMemberList.MarkFlagRequired("orgname")
|
||||
if err := cmdOrgMemberList.MarkFlagRequired("orgname"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdOrgMember.AddCommand(cmdOrgMemberList)
|
||||
}
|
||||
|
|
|
@ -46,8 +46,12 @@ func init() {
|
|||
flags.StringVarP(&orgMemberRemoveOpts.orgname, "orgname", "n", "", "organization name")
|
||||
flags.StringVar(&orgMemberRemoveOpts.username, "username", "", "user name")
|
||||
|
||||
cmdOrgMemberRemove.MarkFlagRequired("orgname")
|
||||
cmdOrgMemberRemove.MarkFlagRequired("username")
|
||||
if err := cmdOrgMemberRemove.MarkFlagRequired("orgname"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdOrgMemberRemove.MarkFlagRequired("username"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdOrgMember.AddCommand(cmdOrgMemberRemove)
|
||||
}
|
||||
|
|
|
@ -55,10 +55,18 @@ func init() {
|
|||
flags.StringVar(&projectCreateOpts.parentPath, "parent", "", `parent project group path (i.e "org/org01" for root project group in org01, "user/user01/group01/subgroub01") or project group id where the project should be created`)
|
||||
flags.StringVar(&projectCreateOpts.visibility, "visibility", "public", `project visibility (public or private)`)
|
||||
|
||||
cmdProjectCreate.MarkFlagRequired("name")
|
||||
cmdProjectCreate.MarkFlagRequired("parent")
|
||||
cmdProjectCreate.MarkFlagRequired("repo-url")
|
||||
cmdProjectCreate.MarkFlagRequired("remote-source")
|
||||
if err := cmdProjectCreate.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectCreate.MarkFlagRequired("parent"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectCreate.MarkFlagRequired("repo-path"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectCreate.MarkFlagRequired("remote-source"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProject.AddCommand(cmdProjectCreate)
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ func init() {
|
|||
|
||||
flags.StringVar(&projectDeleteOpts.projectRef, "project", "", "project id or full path")
|
||||
|
||||
cmdProjectDelete.MarkFlagRequired("project")
|
||||
if err := cmdProjectDelete.MarkFlagRequired("project"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProject.AddCommand(cmdProjectDelete)
|
||||
}
|
||||
|
|
|
@ -49,8 +49,12 @@ func init() {
|
|||
flags.StringVar(&projectGroupCreateOpts.parentPath, "parent", "", `parent project group path (i.e "org/org01" for root project group in org01, "user/user01/group01/subgroub01") or project group id where the project group should be created`)
|
||||
flags.StringVar(&projectGroupCreateOpts.visibility, "visibility", "public", `project group visibility (public or private)`)
|
||||
|
||||
cmdProjectGroupCreate.MarkFlagRequired("name")
|
||||
cmdProjectGroupCreate.MarkFlagRequired("parent")
|
||||
if err := cmdProjectGroupCreate.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectGroupCreate.MarkFlagRequired("parent"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectGroup.AddCommand(cmdProjectGroupCreate)
|
||||
}
|
||||
|
|
|
@ -35,9 +35,15 @@ func init() {
|
|||
flags.StringVarP(&secretCreateOpts.name, "name", "n", "", "secret name")
|
||||
flags.StringVar(&secretCreateOpts.data, "data", "", "json map of secret data")
|
||||
|
||||
cmdProjectGroupSecretCreate.MarkFlagRequired("project")
|
||||
cmdProjectGroupSecretCreate.MarkFlagRequired("name")
|
||||
cmdProjectGroupSecretCreate.MarkFlagRequired("data")
|
||||
if err := cmdProjectGroupSecretCreate.MarkFlagRequired("projectgroup"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectGroupSecretCreate.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectGroupSecretCreate.MarkFlagRequired("data"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectGroupSecret.AddCommand(cmdProjectGroupSecretCreate)
|
||||
}
|
||||
|
|
|
@ -34,8 +34,12 @@ func init() {
|
|||
flags.StringVar(&secretDeleteOpts.parentRef, "projectgroup", "", "project group id or full path")
|
||||
flags.StringVarP(&secretDeleteOpts.name, "name", "n", "", "secret name")
|
||||
|
||||
cmdProjectGroupSecretDelete.MarkFlagRequired("projectgroup")
|
||||
cmdProjectGroupSecretDelete.MarkFlagRequired("name")
|
||||
if err := cmdProjectGroupSecretDelete.MarkFlagRequired("projectgroup"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectGroupSecretDelete.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectGroupSecret.AddCommand(cmdProjectGroupSecretDelete)
|
||||
}
|
||||
|
|
|
@ -35,9 +35,15 @@ func init() {
|
|||
flags.StringVarP(&variableCreateOpts.name, "name", "n", "", "variable name")
|
||||
flags.StringVar(&variableCreateOpts.values, "values", "", "json list of values and conditions")
|
||||
|
||||
cmdProjectGroupVariableCreate.MarkFlagRequired("project")
|
||||
cmdProjectGroupVariableCreate.MarkFlagRequired("name")
|
||||
cmdProjectGroupVariableCreate.MarkFlagRequired("values")
|
||||
if err := cmdProjectGroupVariableCreate.MarkFlagRequired("projectgroup"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectGroupVariableCreate.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectGroupVariableCreate.MarkFlagRequired("values"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectGroupVariable.AddCommand(cmdProjectGroupVariableCreate)
|
||||
}
|
||||
|
|
|
@ -34,8 +34,12 @@ func init() {
|
|||
flags.StringVar(&variableDeleteOpts.parentRef, "projectgroup", "", "project group id or full path")
|
||||
flags.StringVarP(&variableDeleteOpts.name, "name", "n", "", "variable name")
|
||||
|
||||
cmdProjectGroupVariableDelete.MarkFlagRequired("projectgroup")
|
||||
cmdProjectGroupVariableDelete.MarkFlagRequired("name")
|
||||
if err := cmdProjectGroupVariableDelete.MarkFlagRequired("projectgroup"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectGroupVariableDelete.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectGroupVariable.AddCommand(cmdProjectGroupVariableDelete)
|
||||
}
|
||||
|
|
|
@ -39,11 +39,13 @@ type projectListOptions struct {
|
|||
var projectListOpts projectListOptions
|
||||
|
||||
func init() {
|
||||
flags := cmdProjectList.PersistentFlags()
|
||||
flags := cmdProjectList.Flags()
|
||||
|
||||
flags.StringVar(&projectListOpts.parentPath, "parent", "", `project group path (i.e "org/org01" for root project group in org01, "/user/user01/group01/subgroub01") or project group id`)
|
||||
|
||||
cmdProjectList.MarkFlagRequired("parent")
|
||||
if err := cmdProjectList.MarkFlagRequired("parent"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProject.AddCommand(cmdProjectList)
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ func init() {
|
|||
|
||||
flags.StringVarP(&projectReconfigOpts.name, "name", "n", "", "project name")
|
||||
|
||||
cmdProjectReconfig.MarkFlagRequired("name")
|
||||
if err := cmdProjectReconfig.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProject.AddCommand(cmdProjectReconfig)
|
||||
}
|
||||
|
|
|
@ -50,9 +50,15 @@ func init() {
|
|||
flags.StringVarP(&secretCreateOpts.name, "name", "n", "", "secret name")
|
||||
flags.StringVar(&secretCreateOpts.data, "data", "", "json map of secret data")
|
||||
|
||||
cmdProjectSecretCreate.MarkFlagRequired("project")
|
||||
cmdProjectSecretCreate.MarkFlagRequired("name")
|
||||
cmdProjectSecretCreate.MarkFlagRequired("data")
|
||||
if err := cmdProjectSecretCreate.MarkFlagRequired("project"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectSecretCreate.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectSecretCreate.MarkFlagRequired("data"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectSecret.AddCommand(cmdProjectSecretCreate)
|
||||
}
|
||||
|
|
|
@ -46,8 +46,12 @@ func init() {
|
|||
flags.StringVar(&secretDeleteOpts.parentRef, "project", "", "project id or full path")
|
||||
flags.StringVarP(&secretDeleteOpts.name, "name", "n", "", "secret name")
|
||||
|
||||
cmdProjectSecretDelete.MarkFlagRequired("projectgroup")
|
||||
cmdProjectSecretDelete.MarkFlagRequired("name")
|
||||
if err := cmdProjectSecretDelete.MarkFlagRequired("project"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectSecretDelete.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectSecret.AddCommand(cmdProjectSecretDelete)
|
||||
}
|
||||
|
|
|
@ -50,9 +50,15 @@ func init() {
|
|||
flags.StringVarP(&variableCreateOpts.name, "name", "n", "", "variable name")
|
||||
flags.StringVar(&variableCreateOpts.values, "values", "", "json list of values and conditions")
|
||||
|
||||
cmdProjectVariableCreate.MarkFlagRequired("project")
|
||||
cmdProjectVariableCreate.MarkFlagRequired("name")
|
||||
cmdProjectVariableCreate.MarkFlagRequired("values")
|
||||
if err := cmdProjectVariableCreate.MarkFlagRequired("project"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectVariableCreate.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectVariableCreate.MarkFlagRequired("values"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectVariable.AddCommand(cmdProjectVariableCreate)
|
||||
}
|
||||
|
|
|
@ -46,8 +46,12 @@ func init() {
|
|||
flags.StringVar(&variableDeleteOpts.parentRef, "project", "", "project id or full path")
|
||||
flags.StringVarP(&variableDeleteOpts.name, "name", "n", "", "variable name")
|
||||
|
||||
cmdProjectVariableDelete.MarkFlagRequired("projectgroup")
|
||||
cmdProjectVariableDelete.MarkFlagRequired("name")
|
||||
if err := cmdProjectVariableDelete.MarkFlagRequired("project"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdProjectVariableDelete.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdProjectVariable.AddCommand(cmdProjectVariableDelete)
|
||||
}
|
||||
|
|
|
@ -62,10 +62,18 @@ func init() {
|
|||
flags.StringVar(&remoteSourceCreateOpts.sshHostKey, "ssh-host-key", "", "remotesource ssh public host key")
|
||||
flags.BoolVarP(&remoteSourceCreateOpts.skipSSHHostKeyCheck, "skip-ssh-host-key-check", "s", false, "skip ssh host key check")
|
||||
|
||||
cmdRemoteSourceCreate.MarkFlagRequired("name")
|
||||
cmdRemoteSourceCreate.MarkFlagRequired("type")
|
||||
cmdRemoteSourceCreate.MarkFlagRequired("auth-type")
|
||||
cmdRemoteSourceCreate.MarkFlagRequired("api-url")
|
||||
if err := cmdRemoteSourceCreate.MarkFlagRequired("name"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdRemoteSourceCreate.MarkFlagRequired("type"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdRemoteSourceCreate.MarkFlagRequired("auth-type"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdRemoteSourceCreate.MarkFlagRequired("api-url"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdRemoteSource.AddCommand(cmdRemoteSourceCreate)
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ type remoteSourceListOptions struct {
|
|||
var remoteSourceListOpts remoteSourceListOptions
|
||||
|
||||
func init() {
|
||||
flags := cmdRemoteSourceList.PersistentFlags()
|
||||
flags := cmdRemoteSourceList.Flags()
|
||||
|
||||
flags.IntVar(&remoteSourceListOpts.limit, "limit", 10, "max number of runs to show")
|
||||
flags.StringVar(&remoteSourceListOpts.start, "start", "", "starting user name (excluded) to fetch")
|
||||
|
|
|
@ -59,7 +59,9 @@ func init() {
|
|||
flags.StringVar(&remoteSourceUpdateOpts.sshHostKey, "ssh-host-key", "", "remotesource ssh public host key")
|
||||
flags.BoolVarP(&remoteSourceUpdateOpts.skipSSHHostKeyCheck, "skip-ssh-host-key-check", "s", false, "skip ssh host key check")
|
||||
|
||||
cmdRemoteSourceUpdate.MarkFlagRequired("ref")
|
||||
if err := cmdRemoteSourceUpdate.MarkFlagRequired("ref"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdRemoteSource.AddCommand(cmdRemoteSourceUpdate)
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ type runListOptions struct {
|
|||
var runListOpts runListOptions
|
||||
|
||||
func init() {
|
||||
flags := cmdRunList.PersistentFlags()
|
||||
flags := cmdRunList.Flags()
|
||||
|
||||
flags.StringSliceVarP(&runListOpts.statusFilter, "status", "s", nil, "filter runs matching the provided status. This option can be repeated multiple times")
|
||||
flags.StringArrayVarP(&runListOpts.labelFilter, "label", "l", nil, "filter runs matching the provided label. This option can be repeated multiple times, in this case only runs matching all the labels will be returned")
|
||||
|
|
|
@ -72,14 +72,19 @@ type serveOptions struct {
|
|||
var serveOpts serveOptions
|
||||
|
||||
func init() {
|
||||
flags := cmdServe.PersistentFlags()
|
||||
flags := cmdServe.Flags()
|
||||
|
||||
flags.StringVar(&serveOpts.config, "config", "./config.yml", "config file path")
|
||||
flags.StringSliceVar(&serveOpts.components, "components", []string{}, `list of components to start. Specify "all-base" to start all base components (excluding the executor).`)
|
||||
flags.BoolVar(&serveOpts.embeddedEtcd, "embedded-etcd", false, "start and use an embedded etcd, only for testing purpose")
|
||||
flags.StringVar(&serveOpts.embeddedEtcdDataDir, "embedded-etcd-data-dir", "/tmp/agola/etcd", "embedded etcd data dir, only for testing purpose")
|
||||
|
||||
cmdServe.MarkFlagRequired("config")
|
||||
if err := cmdServe.MarkFlagRequired("config"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdServe.MarkFlagRequired("components"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdAgola.AddCommand(cmdServe)
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ func init() {
|
|||
|
||||
flags.StringVarP(&userCreateOpts.username, "username", "n", "", "user name")
|
||||
|
||||
cmdUserCreate.MarkFlagRequired("username")
|
||||
if err := cmdUserCreate.MarkFlagRequired("username"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdUser.AddCommand(cmdUserCreate)
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ func init() {
|
|||
|
||||
flags.StringVarP(&userDeleteOpts.username, "username", "n", "", "user name")
|
||||
|
||||
cmdUserDelete.MarkFlagRequired("username")
|
||||
if err := cmdUserDelete.MarkFlagRequired("username"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdUser.AddCommand(cmdUserDelete)
|
||||
}
|
||||
|
|
|
@ -50,8 +50,12 @@ func init() {
|
|||
flags.StringVar(&userLACreateOpts.remoteSourceLoginName, "remote-name", "", "remote source login name")
|
||||
flags.StringVar(&userLACreateOpts.remoteSourceLoginPassword, "remote-password", "", "remote source password")
|
||||
|
||||
cmdUserLACreate.MarkFlagRequired("username")
|
||||
cmdUserLACreate.MarkFlagRequired("remote-source")
|
||||
if err := cmdUserLACreate.MarkFlagRequired("username"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdUserLACreate.MarkFlagRequired("remote-source"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdUserLA.AddCommand(cmdUserLACreate)
|
||||
}
|
||||
|
|
|
@ -46,8 +46,12 @@ func init() {
|
|||
flags.StringVarP(&userLADeleteOpts.userName, "username", "n", "", "user name")
|
||||
flags.StringVar(&userLADeleteOpts.laID, "laid", "", "linked account id")
|
||||
|
||||
cmdUserLADelete.MarkFlagRequired("username")
|
||||
cmdUserLADelete.MarkFlagRequired("laid")
|
||||
if err := cmdUserLADelete.MarkFlagRequired("username"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdUserLADelete.MarkFlagRequired("laid"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdUserLA.AddCommand(cmdUserLADelete)
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ type userListOptions struct {
|
|||
var userListOpts userListOptions
|
||||
|
||||
func init() {
|
||||
flags := cmdUserList.PersistentFlags()
|
||||
flags := cmdUserList.Flags()
|
||||
|
||||
flags.IntVar(&userListOpts.limit, "limit", 10, "max number of runs to show")
|
||||
flags.StringVar(&userListOpts.start, "start", "", "starting user name (excluded) to fetch")
|
||||
|
|
|
@ -47,8 +47,12 @@ func init() {
|
|||
flags.StringVarP(&userTokenCreateOpts.username, "username", "n", "", "user name")
|
||||
flags.StringVarP(&userTokenCreateOpts.tokenName, "tokenname", "t", "", "token name")
|
||||
|
||||
cmdUserTokenCreate.MarkFlagRequired("username")
|
||||
cmdUserTokenCreate.MarkFlagRequired("tokenname")
|
||||
if err := cmdUserTokenCreate.MarkFlagRequired("username"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdUserTokenCreate.MarkFlagRequired("tokenname"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdUserToken.AddCommand(cmdUserTokenCreate)
|
||||
}
|
||||
|
|
|
@ -46,8 +46,12 @@ func init() {
|
|||
flags.StringVarP(&userTokenDeleteOpts.userName, "username", "n", "", "user name")
|
||||
flags.StringVarP(&userTokenDeleteOpts.tokenName, "tokenname", "t", "", "token name")
|
||||
|
||||
cmdUserTokenDelete.MarkFlagRequired("username")
|
||||
cmdUserTokenDelete.MarkFlagRequired("tokenname")
|
||||
if err := cmdUserTokenDelete.MarkFlagRequired("username"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if err := cmdUserTokenDelete.MarkFlagRequired("tokenname"); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
cmdUserToken.AddCommand(cmdUserTokenDelete)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue