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

Commit 0e031d9

Browse files
committed
Add gendocs ci step
1 parent b9ebf97 commit 0e031d9

26 files changed

+157
-38
lines changed

.github/workflows/test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,17 @@ jobs:
4444
uses: ./ci/image
4545
with:
4646
args: go test ./internal/... ./cmd/...
47+
gendocs:
48+
runs-on: ubuntu-latest
49+
steps:
50+
- uses: actions/checkout@v1
51+
- uses: actions/cache@v1
52+
with:
53+
path: ~/go/pkg/mod
54+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
55+
restore-keys: |
56+
${{ runner.os }}-go-
57+
- name: generate-docs
58+
uses: ./ci/image
59+
with:
60+
args: ./ci/steps/gendocs.sh

ci/steps/fmt.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
#!/bin/bash
2+
3+
set -euo pipefail
4+
25
echo "Formatting..."
36

47
go mod tidy
58
gofmt -w -s .
69
goimports -w "-local=$$(go list -m)" .
710

8-
if [ "$CI" != "" ]; then
9-
if [[ $(git ls-files --other --modified --exclude-standard) != "" ]]; then
11+
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
1012
echo "Files need generation or are formatted incorrectly:"
1113
git -c color.ui=always status | grep --color=no '\e\[31m'
1214
echo "Please run the following locally:"
1315
echo " ./ci/steps/fmt.sh"
1416
exit 1
1517
fi
16-
fi

ci/steps/gendocs.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
echo "Generating docs..."
6+
7+
cd "$(dirname "$0")"
8+
cd ../../
9+
10+
go run ./cmd/coder gen-docs ./docs
11+
12+
# remove cobra footer from each file
13+
for filename in ./docs/*.md; do
14+
trimmed=$(head -n -1 "$filename")
15+
echo "$trimmed" > $filename
16+
done
17+
18+
19+
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
20+
echo "Documentation needs generation:"
21+
git -c color.ui=always status | grep --color=no '\e\[31m'
22+
echo "Please run the following locally:"
23+
echo " ./ci/steps/gendocs.sh"
24+
exit 1
25+
fi

ci/steps/lint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/bin/bash
22

3+
set -euo pipefail
4+
35
echo "Linting..."
46

57
go vet ./...
6-
golint -set_exit_status ./...
8+
golint -set_exit_status ./...

docs/coder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ coder provides a CLI for working with an existing Coder Enterprise installation
1414

1515
### SEE ALSO
1616

17+
* [coder completion](coder_completion.md) - Generate completion script
1718
* [coder config-ssh](coder_config-ssh.md) - Configure SSH to access Coder environments
1819
* [coder envs](coder_envs.md) - Interact with Coder environments
1920
* [coder login](coder_login.md) - Authenticate this client for future operations
@@ -23,4 +24,3 @@ coder provides a CLI for working with an existing Coder Enterprise installation
2324
* [coder sync](coder_sync.md) - Establish a one way directory sync to a Coder environment
2425
* [coder urls](coder_urls.md) - Interact with environment DevURLs
2526
* [coder users](coder_users.md) - Interact with Coder user accounts
26-

docs/coder_completion.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
## coder completion
2+
3+
Generate completion script
4+
5+
### Synopsis
6+
7+
To load completions:
8+
9+
Bash:
10+
11+
$ source <(coder completion bash)
12+
13+
To load completions for each session, execute once:
14+
Linux:
15+
$ coder completion bash > /etc/bash_completion.d/coder
16+
MacOS:
17+
$ coder completion bash > /usr/local/etc/bash_completion.d/coder
18+
19+
Zsh:
20+
21+
If shell completion is not already enabled in your environment you will need
22+
to enable it. You can execute the following once:
23+
24+
$ echo "autoload -U compinit; compinit" >> ~/.zshrc
25+
26+
To load completions for each session, execute once:
27+
$ coder completion zsh > "${fpath[1]}/_coder"
28+
29+
You will need to start a new shell for this setup to take effect.
30+
31+
Fish:
32+
33+
$ coder completion fish | source
34+
35+
To load completions for each session, execute once:
36+
$ coder completion fish > ~/.config/fish/completions/coder.fish
37+
38+
39+
```
40+
coder completion [bash|zsh|fish|powershell]
41+
```
42+
43+
### Examples
44+
45+
```
46+
coder completion fish > ~/.config/fish/completions/coder.fish
47+
coder completion zsh > "${fpath[1]}/_coder"
48+
49+
Linux:
50+
$ coder completion bash > /etc/bash_completion.d/coder
51+
MacOS:
52+
$ coder completion bash > /usr/local/etc/bash_completion.d/coder
53+
```
54+
55+
### Options
56+
57+
```
58+
-h, --help help for completion
59+
```
60+
61+
### SEE ALSO
62+
63+
* [coder](coder.md) - coder provides a CLI for working with an existing Coder Enterprise installation

docs/coder_config-ssh.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ coder config-ssh [flags]
2121
### SEE ALSO
2222

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

docs/coder_envs.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ Perform operations on the Coder environments owned by the active user.
1717

1818
* [coder](coder.md) - coder provides a CLI for working with an existing Coder Enterprise installation
1919
* [coder envs ls](coder_envs_ls.md) - list all environments owned by the active user
20-

docs/coder_envs_ls.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ coder envs ls [flags]
2626
### SEE ALSO
2727

2828
* [coder envs](coder_envs.md) - Interact with Coder environments
29-

docs/coder_login.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ coder login [Coder Enterprise URL eg. http://my.coder.domain/] [flags]
1919
### SEE ALSO
2020

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy