Skip to content

Commit 027d89d

Browse files
authored
chore: Add alias coder agent (#986)
1 parent 300c6d0 commit 027d89d

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed
File renamed without changes.

cli/workspaceagent_test.go renamed to cli/agent_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestWorkspaceAgent(t *testing.T) {
4747
workspace := coderdtest.CreateWorkspace(t, client, codersdk.Me, template.ID)
4848
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
4949

50-
cmd, _ := clitest.New(t, "workspaces", "agent", "--auth", "aws-instance-identity", "--url", client.URL.String())
50+
cmd, _ := clitest.New(t, "agent", "--auth", "aws-instance-identity", "--url", client.URL.String())
5151
ctx, cancelFunc := context.WithCancel(context.Background())
5252
defer cancelFunc()
5353
go func() {
@@ -101,7 +101,7 @@ func TestWorkspaceAgent(t *testing.T) {
101101
workspace := coderdtest.CreateWorkspace(t, client, codersdk.Me, template.ID)
102102
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
103103

104-
cmd, _ := clitest.New(t, "workspaces", "agent", "--auth", "google-instance-identity", "--url", client.URL.String())
104+
cmd, _ := clitest.New(t, "agent", "--auth", "google-instance-identity", "--url", client.URL.String())
105105
ctx, cancelFunc := context.WithCancel(context.Background())
106106
defer cancelFunc()
107107
go func() {

cli/gitssh_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestGitSSH(t *testing.T) {
6565
coderdtest.AwaitWorkspaceBuildJob(t, client, workspace.LatestBuild.ID)
6666

6767
// start workspace agent
68-
cmd, root := clitest.New(t, "workspaces", "agent", "--auth", "aws-instance-identity", "--url", client.URL.String())
68+
cmd, root := clitest.New(t, "agent", "--auth", "aws-instance-identity", "--url", client.URL.String())
6969
agentClient := &*client
7070
clitest.SetupConfig(t, agentClient, root)
7171
ctx, cancelFunc := context.WithCancel(context.Background())

cli/root.go

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func Root() *cobra.Command {
7373
workspaceTunnel(),
7474
gitssh(),
7575
publickey(),
76+
workspaceAgent(),
7677
)
7778

7879
cmd.PersistentFlags().String(varGlobalConfig, configdir.LocalConfig("coderv2"), "Path to the global `coder` config directory")

cli/workspaces.go

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ func workspaces() *cobra.Command {
1313
Use: "workspaces",
1414
Aliases: []string{"ws"},
1515
}
16-
cmd.AddCommand(workspaceAgent())
1716
cmd.AddCommand(workspaceCreate())
1817
cmd.AddCommand(workspaceDelete())
1918
cmd.AddCommand(workspaceList())

provisionersdk/agent.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $ProgressPreference = "SilentlyContinue"
1616
Invoke-WebRequest -Uri ${ACCESS_URL}bin/coder-windows-amd64.exe -OutFile $env:TEMP\sshd.exe
1717
$env:CODER_AUTH = "${AUTH_TYPE}"
1818
$env:CODER_URL = "${ACCESS_URL}"
19-
Start-Process -FilePath $env:TEMP\sshd.exe -ArgumentList "workspaces","agent" -PassThru
19+
Start-Process -FilePath $env:TEMP\sshd.exe -ArgumentList "agent" -PassThru
2020
`,
2121
},
2222
"linux": {
@@ -28,7 +28,7 @@ curl -fsSL ${ACCESS_URL}bin/coder-linux-amd64 -o $BINARY_LOCATION
2828
chmod +x $BINARY_LOCATION
2929
export CODER_AUTH="${AUTH_TYPE}"
3030
export CODER_URL="${ACCESS_URL}"
31-
exec $BINARY_LOCATION workspaces agent
31+
exec $BINARY_LOCATION agent
3232
`,
3333
},
3434
"darwin": {
@@ -40,7 +40,7 @@ curl -fsSL ${ACCESS_URL}bin/coder-darwin-amd64 -o $BINARY_LOCATION
4040
chmod +x $BINARY_LOCATION
4141
export CODER_AUTH="${AUTH_TYPE}"
4242
export CODER_URL="${ACCESS_URL}"
43-
exec $BINARY_LOCATION workspaces agent
43+
exec $BINARY_LOCATION agent
4444
`,
4545
},
4646
}

provisionersdk/agent_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ func TestAgentScript(t *testing.T) {
5151
require.NoError(t, err)
5252
// Because we use the "echo" binary, we should expect the arguments provided
5353
// as the response to executing our script.
54-
require.Equal(t, "workspaces agent", strings.TrimSpace(string(output)))
54+
require.Equal(t, "agent", strings.TrimSpace(string(output)))
5555
})
5656
}

0 commit comments

Comments
 (0)