Optique 0.6.0: Shell completion support for type-safe CLI parsers

洪 民憙 (Hong Minhee) @hongminhee@hackers.pub

Optique 0.6.0 introduces intelligent shell completion to type-safe command-line applications, supporting Bash, zsh, fish, PowerShell, and Nushell. Unlike traditional CLI frameworks, Optique leverages the same parser structure for both argument parsing and completion, eliminating duplicate definitions and ensuring synchronization. Setting up completion is straightforward, with users generating and sourcing a completion script for their shell. The system works automatically with all Optique parser types, offering context-aware suggestions, including file system completion and custom logic for domain-specific value parsers. Additionally, the release enhances command documentation with separate brief, description, and footer texts, and introduces a `commandLine()` message term for clearer command-line examples in help text. Existing Optique users can easily migrate by adding a `completion` option to their `run()` configuration. This release aims to make Optique-based CLIs more user-friendly without sacrificing type safety and composability, providing sophisticated runtime features while maintaining compile-time guarantees.

Read more →
5

If you have a fediverse account, you can quote this article from your own instance. Search https://hackers.pub/ap/articles/0199a487-f042-7890-b356-42304eee47ca on your instance and quote it. (Note that quoting is not supported in Mastodon.)

Optique 0.6.0 is here! Bringing intelligent shell completion to type-safe TypeScript CLI parsers.

Press Tab, get suggestions. No duplicate definitions. Just works with Bash, zsh, fish, PowerShell & Nushell.

Your parsers stay the single source of truth.

1