feat: add tab completion for commands in interactive shell#56
Open
skyc1e wants to merge 1 commit intoPolymarket:mainfrom
Open
feat: add tab completion for commands in interactive shell#56skyc1e wants to merge 1 commit intoPolymarket:mainfrom
skyc1e wants to merge 1 commit intoPolymarket:mainfrom
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, ...).shellandsetupare excluded since they're blocked in the REPL.No new dependencies — just uses
rustyline::completionandclap::CommandFactorythat 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
rustylinehelper (ShellCompleter) that derives available commands/subcommands from clap’sCli::command()(excludingshellandsetup).Updates
run_shell()to userustyline::Editorwith 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.