Skip to content

feat: add shell completion support#58

Open
zyaiire wants to merge 1 commit intoPolymarket:mainfrom
zyaiire:feat/34-shell-completion
Open

feat: add shell completion support#58
zyaiire wants to merge 1 commit intoPolymarket:mainfrom
zyaiire:feat/34-shell-completion

Conversation

@zyaiire
Copy link
Copy Markdown

@zyaiire zyaiire commented Mar 28, 2026

Summary

Fixes #34

Adds shell completion script generation via a new completion subcommand, powered by clap_complete. Supports bash, zsh, fish, elvish, and powershell.

Changes

  • Add clap_complete = "4" dependency to Cargo.toml
  • Add Completion { shell } subcommand to the Commands enum
  • Generate completions to stdout using clap_complete::generate()

Usage

# Generate completion script for your shell
polymarket completion bash > ~/.local/share/bash-completion/completions/polymarket
polymarket completion zsh  > ~/.zfunc/_polymarket
polymarket completion fish > ~/.config/fish/completions/polymarket.fish

Testing

  • cargo build — compiles cleanly
  • cargo test — all 49 tests pass
  • cargo clippy — no warnings
  • Manually verified polymarket completion bash outputs a valid completion script

Notes

  • Minimal change: only 3 files touched (Cargo.toml, Cargo.lock, src/main.rs)
  • No modifications to existing commands
  • Uses the same clap_complete approach suggested in the issue

Note

Low Risk
Low risk: adds a new completion subcommand and dependency without changing existing command execution paths or any network/auth/data-handling logic.

Overview
Adds shell completion generation to the CLI via a new completion subcommand that outputs clap_complete scripts to stdout.

This introduces the clap_complete dependency (and lockfile updates) and wires Commands::Completion { shell } to call clap_complete::generate() using the existing clap command definition.

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

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.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