From b02adb5d8133d14c0f1132ef0f80f71d1b94637c Mon Sep 17 00:00:00 2001 From: AmirSa12 Date: Fri, 10 Jul 2026 23:58:58 +0400 Subject: [PATCH] chore(docs): add dev workflow section --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index 6ecba37..46f15bd 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,44 @@ my-cli complete zsh > ~/.my-cli-completion.zsh echo 'source ~/.my-cli-completion.zsh' >> ~/.zshrc ``` +### Development Workflow + +Generated completion scripts invoke your CLI by its **program name** (e.g. `my-cli`), +which the shell resolves via `PATH`, an alias, or a shell function. During local +development your CLI usually isn't installed on `PATH`, so define a session-scoped +shell function that runs it from source, then source the completions. No build, +no install, and no `PATH` changes are needed — the function disappears when you +close the terminal. + +Replace `my-cli` with your program name and adjust the source path if needed. + +```zsh +# zsh +my-cli() { pnpm tsx src/index.ts "$@"; } +source <(my-cli complete zsh) +``` + +```bash +# bash +my-cli() { pnpm tsx src/index.ts "$@"; } +source <(my-cli complete bash) +``` + +```fish +# fish +function my-cli; pnpm tsx src/index.ts $argv; end +source (my-cli complete fish | psub) +``` + +```powershell +# powershell +function my-cli { pnpm tsx src/index.ts $args } +my-cli complete powershell | Out-String | Invoke-Expression +``` + +The function name must match your CLI's program name so the shell resolves the +completion callback back to it. + ## Package Manager Completions As mentioned earlier, tab provides completions for package managers as well: