Skip to content

simplify CLI: add -o (output) and -e (event) unified flags (#88, #25)#90

Merged
zz85 merged 2 commits into
mainfrom
flags
Apr 5, 2026
Merged

simplify CLI: add -o (output) and -e (event) unified flags (#88, #25)#90
zz85 merged 2 commits into
mainfrom
flags

Conversation

@zz85

@zz85 zz85 commented Apr 5, 2026

Copy link
Copy Markdown
Owner

Replace per-format output flags (--svg, --html, --json, --collapse, --pprof, --codeguru) with a single -o/--output flag that infers format from file extension (.svg, .html, .json, .folded, .pb.gz, .codeguru.json).

Replace per-type probe flags (--kprobe, --uprobe, --tracepoint) with a single -e/--event flag using prefix syntax (kprobe:, uprobe:, tracepoint:, with short forms k:, u:, ur:, t:, tp:). Bare names default to uprobe.

Legacy flags still work (hidden from --help, mentioned in examples section). Both flags are repeatable: -o a.svg -o b.html -e kprobe:fn -e uprobe:malloc

Addresses #88, #25

Summary by CodeRabbit

  • New Features

    • Unified -o/--output flag replaces format-specific options; output format inferred from file extension.
    • Unified -e/--event flag replaces probe-specific options; probe type specified via prefixes (e.g., uprobe:, kprobe:).
    • Added shorthand flags: -t for time, -f for frequency, -p for PID.
  • Documentation

    • Updated CLI examples across README files to reflect new unified syntax and shorthand flags.

zz85 added 2 commits April 5, 2026 04:19
Replace per-format output flags (--svg, --html, --json, --collapse,
--pprof, --codeguru) with a single -o/--output flag that infers format
from file extension (.svg, .html, .json, .folded, .pb.gz, .codeguru.json).

Replace per-type probe flags (--kprobe, --uprobe, --tracepoint) with a
single -e/--event flag using prefix syntax (kprobe:, uprobe:, tracepoint:,
with short forms k:, u:, ur:, t:, tp:). Bare names default to uprobe.

Legacy flags still work (hidden from --help, mentioned in examples section).
Both flags are repeatable: -o a.svg -o b.html -e kprobe:fn -e uprobe:malloc
Update all example commands in README.md, docs/codeguru_format.md, and
profile-bee-tui/README.md to use the new unified flags:
  --svg/--html/etc → -o file.svg/-o file.html
  --kprobe/--uprobe/--tracepoint → -e kprobe:fn/-e uprobe:spec/-e tracepoint:cat:name
  --time → -t, --pid → -p, --cmd → -- <command>
@coderabbitai

coderabbitai Bot commented Apr 5, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 76ba39b9-a177-484c-9c29-878825a9c084

📥 Commits

Reviewing files that changed from the base of the PR and between bec33ac and 732be75.

📒 Files selected for processing (5)
  • README.md
  • docs/codeguru_format.md
  • profile-bee-tui/README.md
  • profile-bee/bin/profile-bee.rs
  • profile-bee/src/probe_spec.rs

📝 Walkthrough

Walkthrough

This PR refactors the profile-bee CLI interface by consolidating format-specific output flags (--svg/--html/--json/--collapse/--pprof/--codeguru) into a unified -o/--output option with format inferred from file extension, and consolidating probe selection flags (--kprobe/--uprobe/--tracepoint) into a unified -e/--event specification with prefix-based parsing. Documentation is updated to reflect the new syntax.

Changes

Cohort / File(s) Summary
Documentation Updates
README.md, docs/codeguru_format.md, profile-bee-tui/README.md
Updated CLI examples to reflect new shorthand flag syntax: -o <file> for output (replacing format-specific flags), -t for time (replacing --time), -e <spec> for event/probe (replacing --uprobe/--kprobe/--tracepoint), and -- for command separator (replacing --cmd).
CLI Refactoring
profile-bee/bin/profile-bee.rs
Replaced format-specific output flags with unified -o/--output vector (format inferred from extension); replaced probe flags with unified -e/--event vector (format from prefix); added OutputFormat enum and parse_event_specs() helper; normalized legacy flags into resolved structures; updated output sink construction and CodeGuru upload logic.
Probe Spec Parsing
profile-bee/src/probe_spec.rs
Added public EventKind enum (Kprobe, Uprobe, Uretprobe, Tracepoint) and parse_event_prefix() function to support prefix-based unified -e/--event specification parsing with precedence-ordered prefix matching (kprobe:, uprobe:, uretprobe:, tracepoint:).

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Poem

🐰 The flags once scattered, now unified with care,
From -o, -e, -t, a cleaner syntax fair!
Old formats fade, as prefixes take their place,
The CLI blooms with elegance and grace! 🌿✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: introducing unified -o (output) and -e (event) flags to simplify the CLI, with issue references for context.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch flags

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zz85 zz85 merged commit 60a80d0 into main Apr 5, 2026
5 checks passed
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.

1 participant