Skip to content
Open
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
1 change: 1 addition & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [Value Buffer Protocol](reference/value-buffers.md)
- [Memory & Error Model](reference/memory-error.md)
- [Naming and Package Conventions](reference/naming.md)
- [Shell Completions](reference/completions.md)
- [Generators](generators/README.md)
- [Kotlin](generators/kotlin.md)
- [C](generators/c.md)
Expand Down
2 changes: 2 additions & 0 deletions docs/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ cargo install weaveffi-cli

This puts the `weaveffi` binary on your `PATH`.

For tab completion in your shell, see [Shell Completions](reference/completions.md).

## 2) Define your API as an IDL

Describe the API once in a language-neutral IDL. Create `math.yml` with a
Expand Down
63 changes: 63 additions & 0 deletions docs/src/reference/completions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Shell Completions

`weaveffi completions <shell>` prints a completion script for bash, zsh, fish, powershell, or elvish. Generate one with:

```bash
weaveffi completions bash
```

Replace `bash` with your shell name. Install the script using the matching section below.

## bash

```bash
mkdir -p ~/.local/share/bash-completion/completions
weaveffi completions bash > ~/.local/share/bash-completion/completions/weaveffi
```

On systems that load `/etc/bash_completion.d`:

```bash
sudo weaveffi completions bash > /etc/bash_completion.d/weaveffi
```

## zsh

Write the script as `_weaveffi` in a directory on your `$fpath`:

```bash
mkdir -p ~/.zfunc
weaveffi completions zsh > ~/.zfunc/_weaveffi
```

Then in `~/.zshrc` (run `compinit` after updating `fpath`):

```zsh
fpath=(~/.zfunc $fpath)
autoload -Uz compinit && compinit
```

## fish

```bash
mkdir -p ~/.config/fish/completions
weaveffi completions fish > ~/.config/fish/completions/weaveffi.fish
```

## PowerShell

Append the script to your profile:

```powershell
weaveffi completions powershell >> $PROFILE
```

Reload the profile or open a new session.

## elvish

Evaluate the script from `rc.elv` (for example):

```elvish
eval (weaveffi completions elvish | slurp)
```
Loading