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

Commit9ad3e70

Browse files
committed
Port over some of clibase
1 parent4fef87b commit9ad3e70

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

‎cli/clibase/cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ func (i *Invokation) run(state *runState) error {
185185

186186
ifi.parsedFlags==nil {
187187
i.parsedFlags=pflag.NewFlagSet(i.Command.Name(),pflag.ContinueOnError)
188+
// We handle Usage ourselves.
188189
i.parsedFlags.Usage=func() {}
189190
}
190191

‎cli/clibase/cmd_test.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -349,24 +349,3 @@ func TestCommand_HyphenHypen(t *testing.T) {
349349

350350
require.Equal(t,"--verbose --friendly",stdio.Stdout.String())
351351
}
352-
353-
funcTestCommand_Help(t*testing.T) {
354-
t.Parallel()
355-
356-
cmd:=&clibase.Cmd{
357-
Options: []clibase.Option{
358-
{
359-
Flag:"superautopets",
360-
},
361-
},
362-
Handler:func(i*clibase.Invokation)error {
363-
t.Fatalf("should not be called")
364-
returnnil
365-
},
366-
}
367-
368-
inv,stdio:=clibasetest.Invoke(cmd,"-h")
369-
err:=inv.Run()
370-
require.NoError(t,err)
371-
require.Contains(t,stdio.Stdout.String(),"superautopets")
372-
}

‎cli/clibase/option_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ func TestOptionSet_ParseEnv(t *testing.T) {
111111
err:=os.SetDefaults()
112112
require.NoError(t,err)
113113

114-
err=os.ParseEnv("CODER_", []string{"CODER_WORKSPACE_NAME="})
114+
err=os.ParseEnv(
115+
clibase.ParseEnviron([]string{"CODER_WORKSPACE_NAME="},"CODER_"),
116+
)
115117
require.NoError(t,err)
116118
require.EqualValues(t,"defname",workspaceName)
117119
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp