Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 0649151

Browse files
committed
fixup! fixup! Add more secret creation input paths
1 parent c591e9c commit 0649151

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cmd/coder/secrets.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"cdr.dev/coder-cli/internal/entclient"
99
"cdr.dev/coder-cli/internal/x/xtabwriter"
10+
"cdr.dev/coder-cli/internal/x/xvalidate"
1011
"github.com/manifoldco/promptui"
1112
"github.com/spf13/pflag"
1213
"golang.org/x/xerrors"
@@ -125,6 +126,13 @@ func (cmd *createSecretCmd) Spec() cli.CommandSpec {
125126
}
126127
}
127128

129+
func (cmd *createSecretCmd) Validate() (e []error) {
130+
if cmd.fromLiteral != "" && cmd.fromFile != "" {
131+
e = append(e, xerrors.Errorf("--from-literal and --from-file cannot both be set"))
132+
}
133+
return e
134+
}
135+
128136
func (cmd *createSecretCmd) Run(fl *pflag.FlagSet) {
129137
var (
130138
client = requireAuth()
@@ -135,6 +143,7 @@ func (cmd *createSecretCmd) Run(fl *pflag.FlagSet) {
135143
if name == "" {
136144
exitUsage(fl)
137145
}
146+
xvalidate.Validate(cmd)
138147

139148
if cmd.fromLiteral != "" {
140149
value = cmd.fromLiteral
@@ -144,7 +153,7 @@ func (cmd *createSecretCmd) Run(fl *pflag.FlagSet) {
144153
value = string(contents)
145154
} else {
146155
prompt := promptui.Prompt{
147-
Label: "Value",
156+
Label: "value",
148157
Mask: '*',
149158
Validate: func(s string) error {
150159
if len(s) < 1 {

0 commit comments

Comments
 (0)