Skip to content

Commit 274c84d

Browse files
committed
Assorted changes
1 parent c8c9e51 commit 274c84d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+250
-299
lines changed

cli/agent.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ import (
2828
"github.com/coder/coder/codersdk/agentsdk"
2929
)
3030

31-
func workspaceAgent() *clibase.Command {
31+
func workspaceAgent() *clibase.Cmd {
3232
var (
3333
auth string
3434
logDir string
3535
pprofAddress string
3636
noReap bool
3737
)
38-
cmd := &clibase.Command{
38+
cmd := &clibase.Cmd{
3939
Use: "agent",
4040
// This command isn't useful to manually execute.
4141
Hidden: true,

cli/clibase/clibasetest/invokation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func FakeIO(i *clibase.Invokation) *IO {
2727
}
2828

2929
// Invoke creates a fake invokation and IO.
30-
func Invoke(cmd *clibase.Command, args ...string) (*clibase.Invokation, *IO) {
30+
func Invoke(cmd *clibase.Cmd, args ...string) (*clibase.Invokation, *IO) {
3131
i := clibase.Invokation{
3232
Args: args,
3333
}

cli/clitest/clitest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (l *logWriter) Write(p []byte) (n int, err error) {
4747
}
4848

4949
func NewWithSubcommands(
50-
t *testing.T, subcommands []*clibase.Command, args ...string,
50+
t *testing.T, subcommands []*clibase.Cmd, args ...string,
5151
) (*clibase.Invokation, config.Root) {
5252
var root cli.RootCmd
5353
cmd := root.Command(subcommands)

cli/cliui/agent_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func TestAgent(t *testing.T) {
2424

2525
var disconnected atomic.Bool
2626
ptty := ptytest.New(t)
27-
cmd := &clibase.Command{
27+
cmd := &clibase.Cmd{
2828
Handler: func(inv *clibase.Invokation) error {
2929
err := cliui.Agent(inv.Context(), inv.Stdout, cliui.AgentOptions{
3030
WorkspaceName: "example",
@@ -70,7 +70,7 @@ func TestAgent_TimeoutWithTroubleshootingURL(t *testing.T) {
7070
wantURL := "https://coder.com/troubleshoot"
7171

7272
var connected, timeout atomic.Bool
73-
cmd := &clibase.Command{
73+
cmd := &clibase.Cmd{
7474
Handler: func(inv *clibase.Invokation) error {
7575
err := cliui.Agent(inv.Context(), inv.Stdout, cliui.AgentOptions{
7676
WorkspaceName: "example",
@@ -124,7 +124,7 @@ func TestAgent_StartupTimeout(t *testing.T) {
124124
setStatus := func(s codersdk.WorkspaceAgentStatus) { status.Store(string(s)) }
125125
setState := func(s codersdk.WorkspaceAgentLifecycle) { state.Store(string(s)) }
126126

127-
cmd := &clibase.Command{
127+
cmd := &clibase.Cmd{
128128
Handler: func(inv *clibase.Invokation) error {
129129
err := cliui.Agent(inv.Context(), inv.Stdout, cliui.AgentOptions{
130130
WorkspaceName: "example",
@@ -186,7 +186,7 @@ func TestAgent_StartErrorExit(t *testing.T) {
186186
var status, state atomic.String
187187
setStatus := func(s codersdk.WorkspaceAgentStatus) { status.Store(string(s)) }
188188
setState := func(s codersdk.WorkspaceAgentLifecycle) { state.Store(string(s)) }
189-
cmd := &clibase.Command{
189+
cmd := &clibase.Cmd{
190190
Handler: func(inv *clibase.Invokation) error {
191191
err := cliui.Agent(inv.Context(), inv.Stdout, cliui.AgentOptions{
192192
WorkspaceName: "example",
@@ -245,7 +245,7 @@ func TestAgent_NoWait(t *testing.T) {
245245
var status, state atomic.String
246246
setStatus := func(s codersdk.WorkspaceAgentStatus) { status.Store(string(s)) }
247247
setState := func(s codersdk.WorkspaceAgentLifecycle) { state.Store(string(s)) }
248-
cmd := &clibase.Command{
248+
cmd := &clibase.Cmd{
249249
Handler: func(inv *clibase.Invokation) error {
250250
err := cliui.Agent(inv.Context(), inv.Stdout, cliui.AgentOptions{
251251
WorkspaceName: "example",
@@ -318,7 +318,7 @@ func TestAgent_LoginBeforeReadyEnabled(t *testing.T) {
318318
var status, state atomic.String
319319
setStatus := func(s codersdk.WorkspaceAgentStatus) { status.Store(string(s)) }
320320
setState := func(s codersdk.WorkspaceAgentLifecycle) { state.Store(string(s)) }
321-
cmd := &clibase.Command{
321+
cmd := &clibase.Cmd{
322322
Handler: func(inv *clibase.Invokation) error {
323323
err := cliui.Agent(inv.Context(), inv.Stdout, cliui.AgentOptions{
324324
WorkspaceName: "example",

cli/cliui/gitauth_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func TestGitAuth(t *testing.T) {
2323
defer cancel()
2424

2525
ptty := ptytest.New(t)
26-
cmd := &clibase.Command{
26+
cmd := &clibase.Cmd{
2727
Handler: func(inv *clibase.Invokation) error {
2828
var fetched atomic.Bool
2929
return cliui.GitAuth(inv.Context(), inv.Stdout, cliui.GitAuthOptions{

cli/cliui/output.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func NewOutputFormatter(formats ...OutputFormat) *OutputFormatter {
4949

5050
// AttachFlags attaches the --output flag to the given command, and any
5151
// additional flags required by the output formatters.
52-
func (f *OutputFormatter) AttachFlags(cmd *clibase.Command) *pflag.FlagSet {
52+
func (f *OutputFormatter) AttachFlags(cmd *clibase.Cmd) *pflag.FlagSet {
5353
fs := cmd.Options.FlagSet()
5454
for _, format := range f.formats {
5555
format.AttachFlags(fs)

cli/cliui/output_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func Test_OutputFormatter(t *testing.T) {
9393
},
9494
)
9595

96-
cmd := &clibase.Command{}
96+
cmd := &clibase.Cmd{}
9797
fs := f.AttachFlags(cmd)
9898

9999
selected, err := fs.GetString("output")

cli/cliui/prompt_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func TestPrompt(t *testing.T) {
148148

149149
func newPrompt(ptty *ptytest.PTY, opts cliui.PromptOptions, invOpt func(inv *clibase.Invokation)) (string, error) {
150150
value := ""
151-
cmd := &clibase.Command{
151+
cmd := &clibase.Cmd{
152152
Handler: func(inv *clibase.Invokation) error {
153153
var err error
154154
value, err = cliui.Prompt(inv, opts)
@@ -213,7 +213,7 @@ func TestPasswordTerminalState(t *testing.T) {
213213

214214
// nolint:unused
215215
func passwordHelper() {
216-
cmd := &clibase.Command{
216+
cmd := &clibase.Cmd{
217217
Handler: func(inv *clibase.Invokation) error {
218218
cliui.Prompt(inv, cliui.PromptOptions{
219219
Text: "Password:",

cli/cliui/provisionerjob_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func newProvisionerJob(t *testing.T) provisionerJobTest {
125125
}
126126
jobLock := sync.Mutex{}
127127
logs := make(chan codersdk.ProvisionerJobLog, 1)
128-
cmd := &clibase.Command{
128+
cmd := &clibase.Cmd{
129129
Handler: func(inv *clibase.Invokation) error {
130130
return cliui.ProvisionerJob(inv.Context(), inv.Stdout, cliui.ProvisionerJobOptions{
131131
FetchInterval: time.Millisecond,

cli/cliui/select_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestSelect(t *testing.T) {
3333

3434
func newSelect(ptty *ptytest.PTY, opts cliui.SelectOptions) (string, error) {
3535
value := ""
36-
cmd := &clibase.Command{
36+
cmd := &clibase.Cmd{
3737
Handler: func(inv *clibase.Invokation) error {
3838
var err error
3939
value, err = cliui.Select(inv, opts)
@@ -75,7 +75,7 @@ func TestRichSelect(t *testing.T) {
7575

7676
func newRichSelect(ptty *ptytest.PTY, opts cliui.RichSelectOptions) (string, error) {
7777
value := ""
78-
cmd := &clibase.Command{
78+
cmd := &clibase.Cmd{
7979
Handler: func(inv *clibase.Invokation) error {
8080
richOption, err := cliui.RichSelect(inv, opts)
8181
if err == nil {

0 commit comments

Comments
 (0)