Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
41 changes: 39 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
name: Doc

on:
pull_request:
push:
branches:
- 'master'

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: shallow clone
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22.0'

- name: build
run: |
cd example
go build

- uses: actions/upload-artifact@v4
with:
name: example
path: example/example
retention-days: 1


word: {needs: build, uses: ./.github/workflows/vhs-template.yml, with: {topic: word}}
nospace: {needs: build, uses: ./.github/workflows/vhs-template.yml, with: {topic: nospace}}
doubleQuote: {needs: build, uses: ./.github/workflows/vhs-template.yml, with: {topic: doubleQuote}}

doc:
needs:
- word
- nospace
- doubleQuote
runs-on: ubuntu-latest
container: ghcr.io/carapace-sh/carapace
steps:
Expand All @@ -17,6 +47,13 @@ jobs:
key: linkcheck
path: docs/book/linkcheck

- uses: actions/download-artifact@v4
with:
path: docs/src/development/vhs/

- name: Display structure of downloaded files
run: ls -R docs/src/development/vhs/

- name: "build docs"
run: |
mdbook build docs
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/vhs-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: vhs template

on:
workflow_call:
inputs:
topic:
required: true
type: string

jobs:
vhs:
runs-on: ubuntu-latest
continue-on-error: true
container: ghcr.io/carapace-sh/vhs
env:
RC_BASH: "ln -sf /carapace/example/example /usr/local/bin/example"
RC_NUSHELL_ENV: "mkdir ~/.cache/\nexample _carapace nushell | save --force ~/.cache/example.nu"
RC_NUSHELL: "source ~/.cache/example.nu\n$$env.config.completions.external.completer = $$example_completer"
steps:
- name: shallow clone
uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: example
path: /usr/local/bin/

- run: chmod +x /usr/local/bin/example

- name: vhs
run: |
cd docs/src/development/vhs/${{ inputs.topic }}
ls *.tape | xargs -n1 vhs

- uses: actions/upload-artifact@v4
with:
name: ${{ inputs.topic }}
path: |
docs/src/development/vhs/${{ inputs.topic }}/
!docs/src/development/vhs/${{ inputs.topic }}/*.tape
retention-days: 1

- name: check
run: |
git diff
[ -z "$(git status --porcelain)" ] # clean workspace unless .ascii files changed

4 changes: 4 additions & 0 deletions .github/workflows/vhs.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RC_BASH="ln -sf /carapace/example/example /usr/local/bin/example"
RC_NUSHELL_ENV="mkdir ~/.cache/\nexample _carapace nushell | save --force ~/.cache/example.nu"
RC_NUSHELL="source ~/.cache/example.nu\n$$env.config.completions.external.completer = $$example_completer"

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ caraparse/caraparse
.cover
dist
docs/book
docs/src/development/vhs/*/out/*.gif
example/cmd/_test_files/*.txt
example/example
example-nonposix/example-nonposix
Expand Down
9 changes: 9 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,12 @@ services:
RC_ZSH: |
export PATH="/carapace/example/:$$PATH"
source <(example _carapace)

vhs:
image: ghcr.io/carapace-sh/vhs
volumes:
- '.:/carapace/'
working_dir: /carapace/docs/src/development/vhs
command: bash --login -c "ls -d */ | xargs -I'{}' bash -c \"cd {};ls *.tape | xargs -n1 vhs\""
env_file:
- .github/workflows/vhs.env
4 changes: 4 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@
- [Zsh](./development/shells/zsh.md)
- [Testing](./development/testing.md)
- [Asciinema](./development/asciinema.md)
- [VHS](./development/vhs.md)
- [Word](./development/vhs/word.md)
- [Nospace](./development/vhs/nospace.md)
- [Double Quote](./development/vhs/doubleQuote.md)
2 changes: 1 addition & 1 deletion docs/src/carapace/gen.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ exec($(command _carapace))
source <(command _carapace)
```

> Directly sourcing multiple completions in your shell init script increases startup time [considerably](https://medium.com/@jzelinskie/please-dont-ship-binaries-with-shell-completion-as-commands-a8b1bcb8a0d0). See [lazycomplete](https://github.com/rsteube/lazycomplete) for a solution to this problem.
> Directly sourcing multiple completions in your shell init script increases startup time [considerably](https://jzelinskie.com/posts/dont-recommend-sourcing-shell-completion/). See [lazycomplete](https://github.com/rsteube/lazycomplete) for a solution to this problem.
1 change: 1 addition & 0 deletions docs/src/development/vhs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# VHS
15 changes: 15 additions & 0 deletions docs/src/development/vhs/bash.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Require example

Set Theme "Snazzy"
Set FontFamily "JetBrains Mono"
Set FontSize 30
Set Width 1400
Set Height 300
Set Padding 0

Set Shell "bash"

Hide
Type@10ms "source <(example _carapace bash)" Enter
Type@10ms "clear" Enter
Show
18 changes: 18 additions & 0 deletions docs/src/development/vhs/doubleQuote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Double Quote

- bash
![](./doubleQuote/out/doubleQuote.bash.gif)
- elvish
![](./doubleQuote/out/doubleQuote.elvish.gif)
- fish
![](./doubleQuote/out/doubleQuote.fish.gif)
- nushell
![](./doubleQuote/out/doubleQuote.nushell.gif)
- oil
![](./doubleQuote/out/doubleQuote.oil.gif)
- powershell
![](./doubleQuote/out/doubleQuote.powershell.gif)
- xonsh
![](./doubleQuote/out/doubleQuote.xonsh.gif)
- zsh
![](./doubleQuote/out/doubleQuote.zsh.gif)
8 changes: 8 additions & 0 deletions docs/src/development/vhs/doubleQuote/doubleQuote.bash.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source ../bash.tape

Output out/doubleQuote.bash.gif
Output out/doubleQuote.bash.ascii

Type `example "ac"` Sleep 1 Tab@1

Sleep 2
8 changes: 8 additions & 0 deletions docs/src/development/vhs/doubleQuote/doubleQuote.elvish.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source ../elvish.tape

Output out/doubleQuote.elvish.gif
Output out/doubleQuote.elvish.ascii

Type `example "ac"` Sleep 1 Tab@1

Sleep 2
8 changes: 8 additions & 0 deletions docs/src/development/vhs/doubleQuote/doubleQuote.fish.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source ../fish.tape

Output out/doubleQuote.fish.gif
Output out/doubleQuote.fish.ascii

Type `example "ac"` Sleep 1 Tab@1

Sleep 2
8 changes: 8 additions & 0 deletions docs/src/development/vhs/doubleQuote/doubleQuote.nushell.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source ../nushell.tape

Output out/doubleQuote.nushell.gif
Output out/doubleQuote.nushell.ascii

Type `example "ac"` Sleep 1 Tab@1

Sleep 2
8 changes: 8 additions & 0 deletions docs/src/development/vhs/doubleQuote/doubleQuote.oil.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source ../oil.tape

Output out/doubleQuote.oil.gif
Output out/doubleQuote.oil.ascii

Type `example "ac"` Sleep 1 Tab@1

Sleep 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source ../powershell.tape

Output out/doubleQuote.powershell.gif
Output out/doubleQuote.powershell.ascii

Type `example "ac"` Sleep 1 Tab@1

Sleep 2
8 changes: 8 additions & 0 deletions docs/src/development/vhs/doubleQuote/doubleQuote.xonsh.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source ../xonsh.tape

Output out/doubleQuote.xonsh.gif
Output out/doubleQuote.xonsh.ascii

Type `example "ac"` Sleep 1 Tab@1

Sleep 2
8 changes: 8 additions & 0 deletions docs/src/development/vhs/doubleQuote/doubleQuote.zsh.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Source ../zsh.tape

Output out/doubleQuote.zsh.gif
Output out/doubleQuote.zsh.ascii

Type `example "ac"` Sleep 1 Tab@1

Sleep 2
40 changes: 40 additions & 0 deletions docs/src/development/vhs/doubleQuote/out/doubleQuote.bash.ascii
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
>






────────────────────────────────────────────────────────────────────────────────
> example "ac"






────────────────────────────────────────────────────────────────────────────────
> example "ac"






────────────────────────────────────────────────────────────────────────────────
> example action






────────────────────────────────────────────────────────────────────────────────
> example action






────────────────────────────────────────────────────────────────────────────────
40 changes: 40 additions & 0 deletions docs/src/development/vhs/doubleQuote/out/doubleQuote.elvish.ascii
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
>






────────────────────────────────────────────────────────────────────────────────
> example "ac"






────────────────────────────────────────────────────────────────────────────────
> example "ac"






────────────────────────────────────────────────────────────────────────────────
> example "action"
COMPLETING argument
action (action example)




────────────────────────────────────────────────────────────────────────────────
> example "action"
COMPLETING argument
action (action example)




────────────────────────────────────────────────────────────────────────────────
40 changes: 40 additions & 0 deletions docs/src/development/vhs/doubleQuote/out/doubleQuote.fish.ascii
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
>






────────────────────────────────────────────────────────────────────────────────
> example "ac"






────────────────────────────────────────────────────────────────────────────────
> example "ac"






────────────────────────────────────────────────────────────────────────────────
> example "action"






────────────────────────────────────────────────────────────────────────────────
> example "action"






────────────────────────────────────────────────────────────────────────────────
Loading
Loading