agola cmd: check MarkFlagRequired errors

This commit is contained in:
Simone Gotti 2019-07-02 13:49:10 +02:00
parent d8a92ba0d1
commit b849e2c07e
31 changed files with 165 additions and 58 deletions

View File

@ -49,7 +49,7 @@ type directRunStartOptions struct {
var directRunStartOpts directRunStartOptions var directRunStartOpts directRunStartOptions
func init() { 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.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") 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")

View File

@ -47,7 +47,9 @@ func init() {
flags.StringVarP(&orgCreateOpts.name, "name", "n", "", "organization name") flags.StringVarP(&orgCreateOpts.name, "name", "n", "", "organization name")
flags.StringVar(&orgCreateOpts.visibility, "visibility", "public", `organization visibility (public or private)`) 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) cmdOrg.AddCommand(cmdOrgCreate)
} }

View File

@ -44,7 +44,9 @@ func init() {
flags.StringVarP(&orgDeleteOpts.name, "name", "n", "", "organization name") flags.StringVarP(&orgDeleteOpts.name, "name", "n", "", "organization name")
cmdOrgDelete.MarkFlagRequired("name") if err := cmdOrgDelete.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
cmdOrg.AddCommand(cmdOrgDelete) cmdOrg.AddCommand(cmdOrgDelete)
} }

View File

@ -49,8 +49,12 @@ func init() {
flags.StringVar(&orgMemberAddOpts.username, "username", "", "user name") flags.StringVar(&orgMemberAddOpts.username, "username", "", "user name")
flags.StringVarP(&orgMemberAddOpts.role, "role", "r", "member", "member role (owner or member)") flags.StringVarP(&orgMemberAddOpts.role, "role", "r", "member", "member role (owner or member)")
cmdOrgMemberAdd.MarkFlagRequired("orgname") if err := cmdOrgMemberAdd.MarkFlagRequired("orgname"); err != nil {
cmdOrgMemberAdd.MarkFlagRequired("username") log.Fatal(err)
}
if err := cmdOrgMemberAdd.MarkFlagRequired("username"); err != nil {
log.Fatal(err)
}
cmdOrgMember.AddCommand(cmdOrgMemberAdd) cmdOrgMember.AddCommand(cmdOrgMemberAdd)
} }

View File

@ -48,7 +48,9 @@ func init() {
flags.StringVarP(&orgMemberListOpts.orgname, "orgname", "n", "", "organization name") flags.StringVarP(&orgMemberListOpts.orgname, "orgname", "n", "", "organization name")
cmdOrgMemberList.MarkFlagRequired("orgname") if err := cmdOrgMemberList.MarkFlagRequired("orgname"); err != nil {
log.Fatal(err)
}
cmdOrgMember.AddCommand(cmdOrgMemberList) cmdOrgMember.AddCommand(cmdOrgMemberList)
} }

View File

@ -46,8 +46,12 @@ func init() {
flags.StringVarP(&orgMemberRemoveOpts.orgname, "orgname", "n", "", "organization name") flags.StringVarP(&orgMemberRemoveOpts.orgname, "orgname", "n", "", "organization name")
flags.StringVar(&orgMemberRemoveOpts.username, "username", "", "user name") flags.StringVar(&orgMemberRemoveOpts.username, "username", "", "user name")
cmdOrgMemberRemove.MarkFlagRequired("orgname") if err := cmdOrgMemberRemove.MarkFlagRequired("orgname"); err != nil {
cmdOrgMemberRemove.MarkFlagRequired("username") log.Fatal(err)
}
if err := cmdOrgMemberRemove.MarkFlagRequired("username"); err != nil {
log.Fatal(err)
}
cmdOrgMember.AddCommand(cmdOrgMemberRemove) cmdOrgMember.AddCommand(cmdOrgMemberRemove)
} }

View File

@ -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.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)`) flags.StringVar(&projectCreateOpts.visibility, "visibility", "public", `project visibility (public or private)`)
cmdProjectCreate.MarkFlagRequired("name") if err := cmdProjectCreate.MarkFlagRequired("name"); err != nil {
cmdProjectCreate.MarkFlagRequired("parent") log.Fatal(err)
cmdProjectCreate.MarkFlagRequired("repo-url") }
cmdProjectCreate.MarkFlagRequired("remote-source") 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) cmdProject.AddCommand(cmdProjectCreate)
} }

View File

@ -44,7 +44,9 @@ func init() {
flags.StringVar(&projectDeleteOpts.projectRef, "project", "", "project id or full path") 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) cmdProject.AddCommand(cmdProjectDelete)
} }

View File

@ -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.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)`) flags.StringVar(&projectGroupCreateOpts.visibility, "visibility", "public", `project group visibility (public or private)`)
cmdProjectGroupCreate.MarkFlagRequired("name") if err := cmdProjectGroupCreate.MarkFlagRequired("name"); err != nil {
cmdProjectGroupCreate.MarkFlagRequired("parent") log.Fatal(err)
}
if err := cmdProjectGroupCreate.MarkFlagRequired("parent"); err != nil {
log.Fatal(err)
}
cmdProjectGroup.AddCommand(cmdProjectGroupCreate) cmdProjectGroup.AddCommand(cmdProjectGroupCreate)
} }

View File

@ -35,9 +35,15 @@ func init() {
flags.StringVarP(&secretCreateOpts.name, "name", "n", "", "secret name") flags.StringVarP(&secretCreateOpts.name, "name", "n", "", "secret name")
flags.StringVar(&secretCreateOpts.data, "data", "", "json map of secret data") flags.StringVar(&secretCreateOpts.data, "data", "", "json map of secret data")
cmdProjectGroupSecretCreate.MarkFlagRequired("project") if err := cmdProjectGroupSecretCreate.MarkFlagRequired("projectgroup"); err != nil {
cmdProjectGroupSecretCreate.MarkFlagRequired("name") log.Fatal(err)
cmdProjectGroupSecretCreate.MarkFlagRequired("data") }
if err := cmdProjectGroupSecretCreate.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
if err := cmdProjectGroupSecretCreate.MarkFlagRequired("data"); err != nil {
log.Fatal(err)
}
cmdProjectGroupSecret.AddCommand(cmdProjectGroupSecretCreate) cmdProjectGroupSecret.AddCommand(cmdProjectGroupSecretCreate)
} }

View File

@ -34,8 +34,12 @@ func init() {
flags.StringVar(&secretDeleteOpts.parentRef, "projectgroup", "", "project group id or full path") flags.StringVar(&secretDeleteOpts.parentRef, "projectgroup", "", "project group id or full path")
flags.StringVarP(&secretDeleteOpts.name, "name", "n", "", "secret name") flags.StringVarP(&secretDeleteOpts.name, "name", "n", "", "secret name")
cmdProjectGroupSecretDelete.MarkFlagRequired("projectgroup") if err := cmdProjectGroupSecretDelete.MarkFlagRequired("projectgroup"); err != nil {
cmdProjectGroupSecretDelete.MarkFlagRequired("name") log.Fatal(err)
}
if err := cmdProjectGroupSecretDelete.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
cmdProjectGroupSecret.AddCommand(cmdProjectGroupSecretDelete) cmdProjectGroupSecret.AddCommand(cmdProjectGroupSecretDelete)
} }

View File

@ -35,9 +35,15 @@ func init() {
flags.StringVarP(&variableCreateOpts.name, "name", "n", "", "variable name") flags.StringVarP(&variableCreateOpts.name, "name", "n", "", "variable name")
flags.StringVar(&variableCreateOpts.values, "values", "", "json list of values and conditions") flags.StringVar(&variableCreateOpts.values, "values", "", "json list of values and conditions")
cmdProjectGroupVariableCreate.MarkFlagRequired("project") if err := cmdProjectGroupVariableCreate.MarkFlagRequired("projectgroup"); err != nil {
cmdProjectGroupVariableCreate.MarkFlagRequired("name") log.Fatal(err)
cmdProjectGroupVariableCreate.MarkFlagRequired("values") }
if err := cmdProjectGroupVariableCreate.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
if err := cmdProjectGroupVariableCreate.MarkFlagRequired("values"); err != nil {
log.Fatal(err)
}
cmdProjectGroupVariable.AddCommand(cmdProjectGroupVariableCreate) cmdProjectGroupVariable.AddCommand(cmdProjectGroupVariableCreate)
} }

View File

@ -34,8 +34,12 @@ func init() {
flags.StringVar(&variableDeleteOpts.parentRef, "projectgroup", "", "project group id or full path") flags.StringVar(&variableDeleteOpts.parentRef, "projectgroup", "", "project group id or full path")
flags.StringVarP(&variableDeleteOpts.name, "name", "n", "", "variable name") flags.StringVarP(&variableDeleteOpts.name, "name", "n", "", "variable name")
cmdProjectGroupVariableDelete.MarkFlagRequired("projectgroup") if err := cmdProjectGroupVariableDelete.MarkFlagRequired("projectgroup"); err != nil {
cmdProjectGroupVariableDelete.MarkFlagRequired("name") log.Fatal(err)
}
if err := cmdProjectGroupVariableDelete.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
cmdProjectGroupVariable.AddCommand(cmdProjectGroupVariableDelete) cmdProjectGroupVariable.AddCommand(cmdProjectGroupVariableDelete)
} }

View File

@ -39,11 +39,13 @@ type projectListOptions struct {
var projectListOpts projectListOptions var projectListOpts projectListOptions
func init() { 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`) 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) cmdProject.AddCommand(cmdProjectList)
} }

View File

@ -44,7 +44,9 @@ func init() {
flags.StringVarP(&projectReconfigOpts.name, "name", "n", "", "project name") flags.StringVarP(&projectReconfigOpts.name, "name", "n", "", "project name")
cmdProjectReconfig.MarkFlagRequired("name") if err := cmdProjectReconfig.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
cmdProject.AddCommand(cmdProjectReconfig) cmdProject.AddCommand(cmdProjectReconfig)
} }

View File

@ -50,9 +50,15 @@ func init() {
flags.StringVarP(&secretCreateOpts.name, "name", "n", "", "secret name") flags.StringVarP(&secretCreateOpts.name, "name", "n", "", "secret name")
flags.StringVar(&secretCreateOpts.data, "data", "", "json map of secret data") flags.StringVar(&secretCreateOpts.data, "data", "", "json map of secret data")
cmdProjectSecretCreate.MarkFlagRequired("project") if err := cmdProjectSecretCreate.MarkFlagRequired("project"); err != nil {
cmdProjectSecretCreate.MarkFlagRequired("name") log.Fatal(err)
cmdProjectSecretCreate.MarkFlagRequired("data") }
if err := cmdProjectSecretCreate.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
if err := cmdProjectSecretCreate.MarkFlagRequired("data"); err != nil {
log.Fatal(err)
}
cmdProjectSecret.AddCommand(cmdProjectSecretCreate) cmdProjectSecret.AddCommand(cmdProjectSecretCreate)
} }

View File

@ -46,8 +46,12 @@ func init() {
flags.StringVar(&secretDeleteOpts.parentRef, "project", "", "project id or full path") flags.StringVar(&secretDeleteOpts.parentRef, "project", "", "project id or full path")
flags.StringVarP(&secretDeleteOpts.name, "name", "n", "", "secret name") flags.StringVarP(&secretDeleteOpts.name, "name", "n", "", "secret name")
cmdProjectSecretDelete.MarkFlagRequired("projectgroup") if err := cmdProjectSecretDelete.MarkFlagRequired("project"); err != nil {
cmdProjectSecretDelete.MarkFlagRequired("name") log.Fatal(err)
}
if err := cmdProjectSecretDelete.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
cmdProjectSecret.AddCommand(cmdProjectSecretDelete) cmdProjectSecret.AddCommand(cmdProjectSecretDelete)
} }

View File

@ -50,9 +50,15 @@ func init() {
flags.StringVarP(&variableCreateOpts.name, "name", "n", "", "variable name") flags.StringVarP(&variableCreateOpts.name, "name", "n", "", "variable name")
flags.StringVar(&variableCreateOpts.values, "values", "", "json list of values and conditions") flags.StringVar(&variableCreateOpts.values, "values", "", "json list of values and conditions")
cmdProjectVariableCreate.MarkFlagRequired("project") if err := cmdProjectVariableCreate.MarkFlagRequired("project"); err != nil {
cmdProjectVariableCreate.MarkFlagRequired("name") log.Fatal(err)
cmdProjectVariableCreate.MarkFlagRequired("values") }
if err := cmdProjectVariableCreate.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
if err := cmdProjectVariableCreate.MarkFlagRequired("values"); err != nil {
log.Fatal(err)
}
cmdProjectVariable.AddCommand(cmdProjectVariableCreate) cmdProjectVariable.AddCommand(cmdProjectVariableCreate)
} }

View File

@ -46,8 +46,12 @@ func init() {
flags.StringVar(&variableDeleteOpts.parentRef, "project", "", "project id or full path") flags.StringVar(&variableDeleteOpts.parentRef, "project", "", "project id or full path")
flags.StringVarP(&variableDeleteOpts.name, "name", "n", "", "variable name") flags.StringVarP(&variableDeleteOpts.name, "name", "n", "", "variable name")
cmdProjectVariableDelete.MarkFlagRequired("projectgroup") if err := cmdProjectVariableDelete.MarkFlagRequired("project"); err != nil {
cmdProjectVariableDelete.MarkFlagRequired("name") log.Fatal(err)
}
if err := cmdProjectVariableDelete.MarkFlagRequired("name"); err != nil {
log.Fatal(err)
}
cmdProjectVariable.AddCommand(cmdProjectVariableDelete) cmdProjectVariable.AddCommand(cmdProjectVariableDelete)
} }

View File

@ -62,10 +62,18 @@ func init() {
flags.StringVar(&remoteSourceCreateOpts.sshHostKey, "ssh-host-key", "", "remotesource ssh public host key") 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") flags.BoolVarP(&remoteSourceCreateOpts.skipSSHHostKeyCheck, "skip-ssh-host-key-check", "s", false, "skip ssh host key check")
cmdRemoteSourceCreate.MarkFlagRequired("name") if err := cmdRemoteSourceCreate.MarkFlagRequired("name"); err != nil {
cmdRemoteSourceCreate.MarkFlagRequired("type") log.Fatal(err)
cmdRemoteSourceCreate.MarkFlagRequired("auth-type") }
cmdRemoteSourceCreate.MarkFlagRequired("api-url") 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) cmdRemoteSource.AddCommand(cmdRemoteSourceCreate)
} }

View File

@ -40,7 +40,7 @@ type remoteSourceListOptions struct {
var remoteSourceListOpts remoteSourceListOptions var remoteSourceListOpts remoteSourceListOptions
func init() { func init() {
flags := cmdRemoteSourceList.PersistentFlags() flags := cmdRemoteSourceList.Flags()
flags.IntVar(&remoteSourceListOpts.limit, "limit", 10, "max number of runs to show") flags.IntVar(&remoteSourceListOpts.limit, "limit", 10, "max number of runs to show")
flags.StringVar(&remoteSourceListOpts.start, "start", "", "starting user name (excluded) to fetch") flags.StringVar(&remoteSourceListOpts.start, "start", "", "starting user name (excluded) to fetch")

View File

@ -59,7 +59,9 @@ func init() {
flags.StringVar(&remoteSourceUpdateOpts.sshHostKey, "ssh-host-key", "", "remotesource ssh public host key") 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") 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) cmdRemoteSource.AddCommand(cmdRemoteSourceUpdate)
} }

View File

@ -43,7 +43,7 @@ type runListOptions struct {
var runListOpts runListOptions var runListOpts runListOptions
func init() { 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.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") 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")

View File

@ -72,14 +72,19 @@ type serveOptions struct {
var serveOpts serveOptions var serveOpts serveOptions
func init() { func init() {
flags := cmdServe.PersistentFlags() flags := cmdServe.Flags()
flags.StringVar(&serveOpts.config, "config", "./config.yml", "config file path") 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.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.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") 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) cmdAgola.AddCommand(cmdServe)
} }

View File

@ -44,7 +44,9 @@ func init() {
flags.StringVarP(&userCreateOpts.username, "username", "n", "", "user name") flags.StringVarP(&userCreateOpts.username, "username", "n", "", "user name")
cmdUserCreate.MarkFlagRequired("username") if err := cmdUserCreate.MarkFlagRequired("username"); err != nil {
log.Fatal(err)
}
cmdUser.AddCommand(cmdUserCreate) cmdUser.AddCommand(cmdUserCreate)
} }

View File

@ -44,7 +44,9 @@ func init() {
flags.StringVarP(&userDeleteOpts.username, "username", "n", "", "user name") flags.StringVarP(&userDeleteOpts.username, "username", "n", "", "user name")
cmdUserDelete.MarkFlagRequired("username") if err := cmdUserDelete.MarkFlagRequired("username"); err != nil {
log.Fatal(err)
}
cmdUser.AddCommand(cmdUserDelete) cmdUser.AddCommand(cmdUserDelete)
} }

View File

@ -50,8 +50,12 @@ func init() {
flags.StringVar(&userLACreateOpts.remoteSourceLoginName, "remote-name", "", "remote source login name") flags.StringVar(&userLACreateOpts.remoteSourceLoginName, "remote-name", "", "remote source login name")
flags.StringVar(&userLACreateOpts.remoteSourceLoginPassword, "remote-password", "", "remote source password") flags.StringVar(&userLACreateOpts.remoteSourceLoginPassword, "remote-password", "", "remote source password")
cmdUserLACreate.MarkFlagRequired("username") if err := cmdUserLACreate.MarkFlagRequired("username"); err != nil {
cmdUserLACreate.MarkFlagRequired("remote-source") log.Fatal(err)
}
if err := cmdUserLACreate.MarkFlagRequired("remote-source"); err != nil {
log.Fatal(err)
}
cmdUserLA.AddCommand(cmdUserLACreate) cmdUserLA.AddCommand(cmdUserLACreate)
} }

View File

@ -46,8 +46,12 @@ func init() {
flags.StringVarP(&userLADeleteOpts.userName, "username", "n", "", "user name") flags.StringVarP(&userLADeleteOpts.userName, "username", "n", "", "user name")
flags.StringVar(&userLADeleteOpts.laID, "laid", "", "linked account id") flags.StringVar(&userLADeleteOpts.laID, "laid", "", "linked account id")
cmdUserLADelete.MarkFlagRequired("username") if err := cmdUserLADelete.MarkFlagRequired("username"); err != nil {
cmdUserLADelete.MarkFlagRequired("laid") log.Fatal(err)
}
if err := cmdUserLADelete.MarkFlagRequired("laid"); err != nil {
log.Fatal(err)
}
cmdUserLA.AddCommand(cmdUserLADelete) cmdUserLA.AddCommand(cmdUserLADelete)
} }

View File

@ -40,7 +40,7 @@ type userListOptions struct {
var userListOpts userListOptions var userListOpts userListOptions
func init() { func init() {
flags := cmdUserList.PersistentFlags() flags := cmdUserList.Flags()
flags.IntVar(&userListOpts.limit, "limit", 10, "max number of runs to show") flags.IntVar(&userListOpts.limit, "limit", 10, "max number of runs to show")
flags.StringVar(&userListOpts.start, "start", "", "starting user name (excluded) to fetch") flags.StringVar(&userListOpts.start, "start", "", "starting user name (excluded) to fetch")

View File

@ -47,8 +47,12 @@ func init() {
flags.StringVarP(&userTokenCreateOpts.username, "username", "n", "", "user name") flags.StringVarP(&userTokenCreateOpts.username, "username", "n", "", "user name")
flags.StringVarP(&userTokenCreateOpts.tokenName, "tokenname", "t", "", "token name") flags.StringVarP(&userTokenCreateOpts.tokenName, "tokenname", "t", "", "token name")
cmdUserTokenCreate.MarkFlagRequired("username") if err := cmdUserTokenCreate.MarkFlagRequired("username"); err != nil {
cmdUserTokenCreate.MarkFlagRequired("tokenname") log.Fatal(err)
}
if err := cmdUserTokenCreate.MarkFlagRequired("tokenname"); err != nil {
log.Fatal(err)
}
cmdUserToken.AddCommand(cmdUserTokenCreate) cmdUserToken.AddCommand(cmdUserTokenCreate)
} }

View File

@ -46,8 +46,12 @@ func init() {
flags.StringVarP(&userTokenDeleteOpts.userName, "username", "n", "", "user name") flags.StringVarP(&userTokenDeleteOpts.userName, "username", "n", "", "user name")
flags.StringVarP(&userTokenDeleteOpts.tokenName, "tokenname", "t", "", "token name") flags.StringVarP(&userTokenDeleteOpts.tokenName, "tokenname", "t", "", "token name")
cmdUserTokenDelete.MarkFlagRequired("username") if err := cmdUserTokenDelete.MarkFlagRequired("username"); err != nil {
cmdUserTokenDelete.MarkFlagRequired("tokenname") log.Fatal(err)
}
if err := cmdUserTokenDelete.MarkFlagRequired("tokenname"); err != nil {
log.Fatal(err)
}
cmdUserToken.AddCommand(cmdUserTokenDelete) cmdUserToken.AddCommand(cmdUserTokenDelete)
} }