dwmkerr / dwmkerr/git-workforest

feat: shell tab completion (bash/zsh/fish)

Open
#45 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
3d 23h
Merged PRs (30d)
1

Description

## Summary

Add a `git forest completion ` subcommand that emits a shell completion script, following the convention used by `npm`, `gh`, `kubectl`, `rustup`, etc.

## Usage

```bash
# one-shot (add to ~/.bashrc or ~/.zshrc)
eval "$(git-forest completion bash)"

# or install statically
git-forest completion bash > /usr/local/etc/bash_completion.d/git-forest
```

## Scope

- Complete subcommands: `clone`, `add`, `list`, `remove`, `migrate`, `init`, `completion`
- Complete flags per subcommand (e.g. `-f` for `remove`, `-y` for `clone`)
- Complete branch names for `add ` and `remove ` by reading the current forest's trees
- Works for `workforest`, `git-workforest`, and `git-forest` binary invocations

## Known caveat

`git forest ` (invoked via git's external-command dispatch) won't autocomplete subcommands without hooking into git's own completion machinery — that's a bigger lift and out of scope for this issue. `git-forest ` will work.

## Implementation notes

- commander.js has no built-in completion as of 2025 (see tj/commander.js#385)
- Prefer hand-written shell scripts over a runtime dependency (tabtab, carapace, etc.) to match workforest's no-magic style — ~80 lines per shell

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.