Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commita5f34c9

Browse files
committed
fixup! Add --user flag to "secrets" and "envs"
1 parent13a89c4 commita5f34c9

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

‎cmd/coder/envs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func makeEnvsCommand() *cobra.Command {
1818
Short:"Interact with Coder environments",
1919
Long:"Perform operations on the Coder environments owned by the active user.",
2020
}
21-
cmd.PersistentFlags().StringVar(&user,"user",entclient.Me,"Specify the user whose resources to target")
21+
cmd.PersistentFlags().StringVar(&user,"user",entclient.Me,"Specify the user whose resources to target")
2222

2323
lsCmd:=&cobra.Command{
2424
Use:"ls",

‎cmd/coder/secrets.go

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -156,30 +156,30 @@ func listSecrets(user *string) func(cmd *cobra.Command, _ []string) error {
156156
}
157157

158158
funcmakeViewSecret(user*string)func(cmd*cobra.Command,args []string)error {
159-
returnfunc(_*cobra.Command,args []string)error {
160-
var (
161-
client=requireAuth(*user)
162-
name=args[0]
163-
)
164-
ifname=="" {
165-
returnxerrors.New("[name] is a required argument")
166-
}
159+
returnfunc(_*cobra.Command,args []string)error {
160+
var (
161+
client=requireAuth(*user)
162+
name=args[0]
163+
)
164+
ifname=="" {
165+
returnxerrors.New("[name] is a required argument")
166+
}
167167

168-
secret,err:=client.SecretByName(name)
169-
iferr!=nil {
170-
returnxerrors.Errorf("get secret by name: %w",err)
171-
}
168+
secret,err:=client.SecretByName(name)
169+
iferr!=nil {
170+
returnxerrors.Errorf("get secret by name: %w",err)
171+
}
172172

173-
_,err=fmt.Fprintln(os.Stdout,secret.Value)
174-
iferr!=nil {
175-
returnxerrors.Errorf("write secret value: %w",err)
176-
}
177-
returnnil
178-
}
173+
_,err=fmt.Fprintln(os.Stdout,secret.Value)
174+
iferr!=nil {
175+
returnxerrors.Errorf("write secret value: %w",err)
176+
}
177+
returnnil
178+
}
179179
}
180180

181181
funcmakeRemoveSecrets(user*string)func(c*cobra.Command,args []string)error {
182-
returnfunc(_*cobra.Command,args []string)error {
182+
returnfunc(_*cobra.Command,args []string)error {
183183
var (
184184
client=requireAuth(*user)
185185
)
@@ -203,4 +203,3 @@ func makeRemoveSecrets(user *string) func(c *cobra.Command, args []string) error
203203
returnnil
204204
}
205205
}
206-

‎cmd/coder/shell.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import (
2020
"go.coder.com/flog"
2121
)
2222

23-
funcgetEnvsForCompletion() []string {
23+
funcgetEnvsForCompletion(userstring) []string {
2424
varenvNames []string
25-
client,err:=newClient()
25+
client,err:=newClient(user)
2626
iferr!=nil {
2727
returnenvNames
2828
}
@@ -43,7 +43,7 @@ func makeShellCmd() *cobra.Command {
4343
Long:"Execute a remote command on the environment\\nIf no command is specified, the default shell is opened.",
4444
Args:cobra.MinimumNArgs(1),
4545
DisableFlagParsing:true,
46-
ValidArgs:getEnvsForCompletion(),
46+
ValidArgs:getEnvsForCompletion(entclient.Me),
4747
RunE:shell,
4848
Example:"coder sh backend-env",
4949
}

‎cmd/coder/urls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func makeURLCmd() *cobra.Command {
2727
Use:"ls [environment_name]",
2828
Short:"List all DevURLs for an environment",
2929
Args:cobra.ExactArgs(1),
30-
ValidArgs:getEnvsForCompletion(),
30+
ValidArgs:getEnvsForCompletion(entclient.Me),
3131
RunE:makeListDevURLs(&outputFmt),
3232
}
3333
lsCmd.Flags().StringVarP(&outputFmt,"output","o","human","human|json")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp