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

Commit

Permalink
feat: Add update command to coder-cli (#417)
Browse files Browse the repository at this point in the history
* feat: Add update command to coder-cli

This commit adds a new update subcommand that queries a Coder instance
for its current version, fetches the corresponding version from
GitHub releases if required, and updates the binary in-place.
  • Loading branch information
johnstcn authored Aug 17, 2021
1 parent 4117dc8 commit 59a0a20
Show file tree
Hide file tree
Showing 8 changed files with 1,074 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/coder.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ coder provides a CLI for working with an existing Coder installation
* [coder ssh](coder_ssh.md) - Enter a shell of execute a command over SSH into a Coder workspace
* [coder sync](coder_sync.md) - Establish a one way directory sync to a Coder workspace
* [coder tokens](coder_tokens.md) - manage Coder API tokens for the active user
* [coder update](coder_update.md) - Update coder binary
* [coder urls](coder_urls.md) - Interact with workspace DevURLs
* [coder users](coder_users.md) - Interact with Coder user accounts
* [coder workspaces](coder_workspaces.md) - Interact with Coder workspaces
Expand Down
31 changes: 31 additions & 0 deletions docs/coder_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## coder update

Update coder binary

### Synopsis

Update coder to the version matching a given coder instance.

```
coder update [flags]
```

### Options

```
--coder string query this coder instance for the matching version
--force do not prompt for confirmation
-h, --help help for update
--version string explicitly specify which version to fetch and install
```

### 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 installation

2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ go 1.14
require (
cdr.dev/slog v1.4.1
cdr.dev/wsep v0.0.0-20200728013649-82316a09813f
github.com/Masterminds/semver/v3 v3.1.1
github.com/briandowns/spinner v1.16.0
github.com/cli/safeexec v1.0.0
github.com/fatih/color v1.12.0
Expand All @@ -23,6 +24,7 @@ require (
github.com/pion/webrtc/v3 v3.0.32
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
github.com/rjeczalik/notify v0.9.2
github.com/spf13/afero v1.6.0
github.com/spf13/cobra v1.2.1
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
Expand Down
3 changes: 3 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0=
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
Expand Down Expand Up @@ -378,6 +380,7 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5I
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/spf13/afero v1.6.0 h1:xoax2sJ2DT8S8xA2paPFjDCScCNeWsg75VG0DLRreiY=
github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I=
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw=
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func Make() *cobra.Command {
tagsCmd(),
tokensCmd(),
tunnelCmd(),
updateCmd(),
urlCmd(),
usersCmd(),
workspacesCmd(),
Expand Down
Loading

0 comments on commit 59a0a20

Please sign in to comment.