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

feat: replace coder sh implementation to shell out to ssh #292

Merged
merged 5 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! feat: replace coder sh implementation to shell out to ssh
  • Loading branch information
cmoog committed Mar 17, 2021
commit 672ce07537839ce543e81070542aca37233f62c1
2 changes: 1 addition & 1 deletion docs/coder.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ coder provides a CLI for working with an existing Coder Enterprise installation
* [coder images](coder_images.md) - Manage Coder images
* [coder login](coder_login.md) - Authenticate this client for future operations
* [coder logout](coder_logout.md) - Remove local authentication credentials if any exist
* [coder sh](coder_sh.md) - Open a shell and execute commands in a Coder environment
* [coder ssh](coder_ssh.md) - Enter a shell of execute a command over SSH into a Coder environment
* [coder sync](coder_sync.md) - Establish a one way directory sync to a Coder environment
* [coder tokens](coder_tokens.md) - manage Coder API tokens for the active user
* [coder urls](coder_urls.md) - Interact with environment DevURLs
Expand Down
37 changes: 0 additions & 37 deletions docs/coder_sh.md

This file was deleted.

31 changes: 31 additions & 0 deletions docs/coder_ssh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## coder ssh

Enter a shell of execute a command over SSH into a Coder environment

```
coder ssh [environment_name] [flags]
```

### Examples

```
coder ssh my-dev
coder ssh my-dev pwd
```

### Options

```
-h, --help help for ssh
```

### Options inherited from parent commands

```
-v, --verbose show verbose output
```

### SEE ALSO

* [coder](coder.md) - coder provides a CLI for working with an existing Coder Enterprise installation

2 changes: 0 additions & 2 deletions internal/cmd/shell.go

This file was deleted.

13 changes: 9 additions & 4 deletions internal/cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ var (

func sshCmd() *cobra.Command {
cmd := cobra.Command{
Use: "sh",
Args: shValidArgs,
RunE: shell,
Use: "ssh [environment_name]",
Short: "Enter a shell of execute a command over SSH into a Coder environment",
Args: shValidArgs,
Example: `coder ssh my-dev
coder ssh my-dev pwd`,
Aliases: []string{"sh"},
RunE: shell,
}
return &cmd
}
Expand Down Expand Up @@ -83,7 +87,8 @@ func shell(cmd *cobra.Command, args []string) error {
// special handling for the common case of "coder sh" input without a positional argument.
func shValidArgs(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()
if err := cobra.MinimumNArgs(1)(cmd, args); err != nil {
err := cobra.MinimumNArgs(1)(cmd, args)
if err != nil {
client, err := newClient(ctx)
if err != nil {
return clog.Error("missing [environment_name] argument")
Expand Down