https://github.com/gutenye/commander-completion-carapace
Effortlessly add intelligent autocomplete support to your Commander.js CLI app using Carapace. Supports Bash, Zsh, Fish, Nushell and more
https://github.com/gutenye/commander-completion-carapace
autocomplete bash carapace commander commanderjs complete completion fish nushell zsh
Last synced: 8 months ago
JSON representation
Effortlessly add intelligent autocomplete support to your Commander.js CLI app using Carapace. Supports Bash, Zsh, Fish, Nushell and more
- Host: GitHub
- URL: https://github.com/gutenye/commander-completion-carapace
- Owner: gutenye
- License: mit
- Created: 2024-12-26T05:14:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-28T08:27:28.000Z (over 1 year ago)
- Last Synced: 2025-02-05T18:03:08.405Z (over 1 year ago)
- Topics: autocomplete, bash, carapace, commander, commanderjs, complete, completion, fish, nushell, zsh
- Language: TypeScript
- Homepage:
- Size: 184 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# β Commander Completion Carapace β
[](https://github.com/gutenye/commander-completion-carapace) [](https://www.npmjs.com/package/@gutenye/commander-completion-carapace) [](https://github.com/gutenye/commander-completion-carapace/blob/main/LICENSE) [](https://github.com/gutenye/commander-completion-carapace#-contribute)
Effortlessly add intelligent autocomplete support to your [Commander.js](https://github.com/tj/commander.js) CLI app using [Carapace](https://github.com/carapace-sh/carapace-bin).
It works with a wide range of shells, making your CLI tools more intuitive and user-friendly.
**Show your β€οΈ and support by starring this project and following the author, [Guten Ye](https://github.com/gutenye)!**

## π Features
- β **Multiple Shells Support**: Works with Bash, Zsh, Fish, Nushell, and more.
- π **Blazing Fast Completion**: Experience instantaneous completion with no delays.
- π **Carapace Integration**: Unlock all the powerful features of Carapace, including advanced shell completions.
- π§βπ» **Effortless Integration**: Easily add completion support to your Commander.js based CLI app.
## π Getting Started
### 1οΈβ£ Install
First, make sure Carapace is installed, as it powers the completion functionality:
```sh
bun add @gutenye/commander-completion-carapace commander
```
### 2οΈβ£ Write Completion Code
Now, integrate completion support into your Commander.js application by adding the following code:
```ts
import { program, Option } from '@gutenye/commander-completion-carapace'
program
.name('hello')
.enableCompletion()
program.command('cmd1 [...files]')
.description('Description')
.option('--option1', 'Description')
.completion({ // pass to carapace
positionalany: ['$files'] // dynamic completion
})
.action(() => {})
await program.installCompletion() // Creates hello.yaml Carapace spec file
program.parse()
```
### 3οΈβ£ Use the Completion
```sh
hello # Will create the Carapace spec file the first time it runs
hello # Press Tab to see completions for commands and options
```
## π€ Contribute
We welcome contributions! Whether itβs bug reports, feature suggestions, or pull requests, your involvement makes this project better.
**How to Contribute:**
1. Fork the Repository
2. Open a Pull Request on Github
---
Thank you for using Commander Completion Carapace! β¨ If you found it helpful, please βοΈ star the project οΈοΈβ on GitHub. If you encounter any issues, feel free to report an issue on Github.
**Special thanks to all the contributors:**
[](https://github.com/gutenye/commander-completion-carapace/graphs/contributors)
[β¬ Back to top β¬](#readme)