Skip to content

feat: add compare command for side-by-side token comparison (Fixes #23)#33

Closed
lb1192176991-lab wants to merge 1 commit into
codegraphtheory:mainfrom
lb1192176991-lab:feat/compare-command-23
Closed

feat: add compare command for side-by-side token comparison (Fixes #23)#33
lb1192176991-lab wants to merge 1 commit into
codegraphtheory:mainfrom
lb1192176991-lab:feat/compare-command-23

Conversation

@lb1192176991-lab

Copy link
Copy Markdown
Contributor

What

Adds a compare CLI command that runs rug_check_token on multiple mint addresses and displays a side-by-side ASCII comparison table in the terminal.

Why

Portfolio scanners, wallet analysis, and token research all involve comparing multiple tokens at once. Currently users must run solana-rug token N times and compare manually. This makes it a one-shot operation.

Implementation

New function: _format_comparison_table(reports, sort_by)

  • Renders a clean ASCII table with auto-sized columns
  • Rows include: Safety Score, Risk Level, Price, 24h Change, Liquidity, Volume, Holders, Top 10%, Warnings
  • Sortable by: score (ascending, riskiest first), name, age, liquidity
  • Falls back to "—" for missing data, no crashes

New CLI command: compare

  • solana-rug compare <MINT1> <MINT2> [<MINT3> ...] — 2-20 tokens
  • --json flag outputs JSON array instead of table
  • --sort score|name|age|liquidity
  • Graceful error handling: failed tokens show "ERROR" risk level, others continue

Test coverage (stdlib-only, no new deps)

  • Two-token table rendering
  • Sort-by-name ordering
  • Empty list returns empty string

Example output

Metric       | RUG  | BONK
------------ | ---- | ----
Safety Score | 35   | 95
Risk Level   | HIGH | LOW
Price        | —    | —
24h Change   | —    | —
Liquidity    | —    | —
Volume 24h   | —    | —
Holders      | —    | —
Top 10%      | —    | —
Warnings     | 2    | 0

Fixes: #23

@codegraphtheory

Copy link
Copy Markdown
Owner

Sorry about this. The compare command was already merged in #42 from a different branch that had the same feature. Thank you for submitting and please try another bounty issue. We appreciate your contribution.

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.

Cross-token comparison mode: solana-rug compare

2 participants