Add tauri-plugin-cli and print CLI matches#1752
Conversation
Add the tauri-plugin-cli dependency to the workspace and the desktop tauri app, register the plugin in lib.rs, and print CLI matches during setup. This is needed to follow the tauri v2 CLI plugin integration: the change wires the plugin into the app, calls app.cli().matches() to inspect CLI input (currently just prints the matches or an error), and adjusts some app handle usage so plugin and menu creation use a cloned app_handle. The edits ensure the CLI is handled purely in Rust and prepare for further CLI functionality. v
✅ Deploy Preview for hyprnote ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe pull request integrates the Changes
Sequence DiagramsequenceDiagram
participant app as Tauri App
participant cli as CLI Plugin
participant setup as Setup Handler
participant tray as Tray/Menu
app->>cli: Initialize plugin
activate cli
cli-->>app: Plugin ready
deactivate cli
app->>setup: Run setup
activate setup
setup->>cli: Parse CLI arguments
cli-->>setup: Return CLI matches
setup->>setup: Log result or error
setup->>tray: Configure with app_handle
setup->>tray: Mount specta events
deactivate setup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (3)
Cargo.toml(1 hunks)apps/desktop/src-tauri/Cargo.toml(1 hunks)apps/desktop/src-tauri/src/lib.rs(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/desktop/src-tauri/src/lib.rs (5)
plugins/local-llm/src/lib.rs (1)
init(64-112)plugins/tracing/src/lib.rs (1)
init(30-64)plugins/listener/src/lib.rs (1)
init(51-67)plugins/webhook/src/lib.rs (1)
init(27-42)plugins/windows/src/lib.rs (1)
init(62-83)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: ci (macos, macos-14)
- GitHub Check: fmt
🔇 Additional comments (6)
apps/desktop/src-tauri/Cargo.toml (1)
26-26: LGTM!The dependency addition follows the existing pattern and is correctly placed in alphabetical order.
apps/desktop/src-tauri/src/lib.rs (5)
8-8: LGTM!The import is necessary for the CLI plugin integration.
48-48: LGTM!The plugin initialization is correctly placed in the plugin chain.
108-109: LGTM!The tray and app menu initialization follows the established pattern. The use of
unwrap()is acceptable here since failures during setup should halt application initialization.
123-123: LGTM!The event mounting is consistent with the
app_handlepattern used throughout the setup closure.
102-104: Disregard the review comment—the app_handle refactoring is necessary and correct.The
app_info_menuandapp_new_menufunctions require&AppHandle<R>parameters, and the code correctly:
- Clones
app.handle()to obtain ownership (line 102)- Clones again to move into the async closure while preserving
app_handlefor sync use (line 104)This pattern is required because the code needs to use
app_handlefor the synchronous trait method calls (create_tray_menu(),create_app_menu(),mount_events()) while also moving a clone into thetokio::spawnclosure. The refactoring is not unnecessary—it satisfies both Rust's move semantics and the trait's type requirements.Likely an incorrect or invalid review comment.
No description provided.