Skip to content

feat: add tab completion for commands in interactive shell#56

Open
skyc1e wants to merge 1 commit intoPolymarket:mainfrom
skyc1e:feat/shell-tab-completion
Open

feat: add tab completion for commands in interactive shell#56
skyc1e wants to merge 1 commit intoPolymarket:mainfrom
skyc1e:feat/shell-tab-completion

Conversation

@skyc1e
Copy link

@skyc1e skyc1e commented Mar 24, 2026

Adds tab completion for commands and subcommands in the interactive shell (issue #34).

The completer pulls the command tree directly from clap's CommandFactory, so it stays in sync automatically when new commands are added. No hardcoded lists.

Pressing Tab on an empty prompt shows all available commands. Typing a command + space + Tab shows its subcommands (e.g. clob book, price, spread, ...). shell and setup are excluded since they're blocked in the REPL.

No new dependencies — just uses rustyline::completion and clap::CommandFactory that are already in the tree.

Closes #34


Note

Low Risk
Low risk: changes are isolated to the interactive shell input layer and only affect readline behavior (completion/editor initialization), not command execution or data handling.

Overview
Adds tab-completion to the interactive shell by introducing a rustyline helper (ShellCompleter) that derives available commands/subcommands from clap’s Cli::command() (excluding shell and setup).

Updates run_shell() to use rustyline::Editor with the new helper and prints a completion hint, enabling Tab completion for top-level commands and their immediate subcommands.

Written by Cursor Bugbot for commit c1e927d. This will update automatically on new commits. Configure here.

Implements a ShellCompleter using rustyline's Completer trait that
provides tab completion for top-level commands and subcommands in the
REPL. The completion tree is derived from clap's CommandFactory so it
stays in sync with the CLI definition automatically.

Closes Polymarket#34

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add auto complete for sub commands

1 participant