Skip to content

Commit 52b4313

Browse files
authored
Add cli2 plugin wrapping official cli plugin (#1757)
1 parent 5f56bf0 commit 52b4313

File tree

28 files changed

+990
-10
lines changed

28 files changed

+990
-10
lines changed

.cursor/commands/manage-cli.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Based on `plugins/cli`, you might need to update:
2+
- `apps/web/content/docs/cli.mdx`
3+
- `apps/desktop/src-tauri/tauri.conf.json`
4+
5+
Ref: https://v2.tauri.app/plugin/cli

Cargo.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ tauri-plugin-updater = "2.9"
111111
tauri-plugin-analytics = { path = "plugins/analytics" }
112112
tauri-plugin-apple-calendar = { path = "plugins/apple-calendar" }
113113
tauri-plugin-auth = { path = "plugins/auth" }
114+
tauri-plugin-cli2 = { path = "plugins/cli2" }
114115
tauri-plugin-db = { path = "plugins/db" }
115116
tauri-plugin-db2 = { path = "plugins/db2" }
116117
tauri-plugin-detect = { path = "plugins/detect" }
@@ -157,6 +158,7 @@ indoc = "2"
157158
itertools = "0.14.0"
158159
lazy_static = "1.5.0"
159160
once_cell = "1.20.3"
161+
open = "5"
160162
regex = "1.11.1"
161163
schemars = "0.8.21"
162164
serde = "1"

apps/desktop/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@hypr/codemirror": "workspace:^",
3131
"@hypr/db": "workspace:*",
3232
"@hypr/plugin-analytics": "workspace:*",
33+
"@hypr/plugin-cli2": "workspace:*",
3334
"@hypr/plugin-db2": "workspace:*",
3435
"@hypr/plugin-detect": "workspace:*",
3536
"@hypr/plugin-hooks": "workspace:*",

apps/desktop/src-tauri/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ tauri-plugin-analytics = { workspace = true }
2424
tauri-plugin-auth = { workspace = true }
2525
tauri-plugin-autostart = { workspace = true }
2626
tauri-plugin-cli = { workspace = true }
27+
tauri-plugin-cli2 = { workspace = true }
2728
tauri-plugin-clipboard-manager = { workspace = true }
2829
tauri-plugin-db2 = { workspace = true }
2930
tauri-plugin-deep-link = { workspace = true }

apps/desktop/src-tauri/capabilities/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"tray:default",
7676
"auth:default",
7777
"analytics:default",
78+
"cli2:default",
7879
"updater:default",
7980
"deep-link:default",
8081
"store:default",

apps/desktop/src-tauri/src/lib.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ mod store;
55
use ext::*;
66
use store::*;
77

8-
use tauri_plugin_cli::CliExt;
98
use tauri_plugin_windows::{AppWindow, WindowsPluginExt};
109

1110
#[tokio::main]
@@ -46,6 +45,7 @@ pub async fn main() {
4645

4746
builder = builder
4847
.plugin(tauri_plugin_cli::init())
48+
.plugin(tauri_plugin_cli2::init())
4949
.plugin(tauri_plugin_opener::init())
5050
.plugin(tauri_plugin_dialog::init())
5151
.plugin(tauri_plugin_auth::init())
@@ -90,15 +90,6 @@ pub async fn main() {
9090
.invoke_handler(specta_builder.invoke_handler())
9191
.on_window_event(tauri_plugin_windows::on_window_event)
9292
.setup(move |app| {
93-
match app.cli().matches() {
94-
Ok(matches) => {
95-
println!("{matches:?}");
96-
}
97-
Err(error) => {
98-
println!("failed to read CLI matches: {error}");
99-
}
100-
}
101-
10293
let app_handle = app.handle().clone();
10394

10495
let app_clone = app_handle.clone();

apps/desktop/src-tauri/tauri.conf.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@
5252
}
5353
},
5454
"plugins": {
55+
"cli": {
56+
"description": "Hyprnote",
57+
"args": [],
58+
"subcommands": {
59+
"hello": {
60+
"description": "Open https://hyprnote.com"
61+
}
62+
}
63+
},
5564
"deep-link": {
5665
"desktop": {
5766
"schemes": [

apps/web/content/docs/cli.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
title: CLI
3+
description: Learn how to use CLI in Hyprnote
4+
---

plugins/cli2/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/.vs
2+
.DS_Store
3+
.Thumbs.db
4+
*.sublime*
5+
.idea/
6+
debug.log
7+
package-lock.json
8+
.vscode/settings.json
9+
yarn.lock
10+
11+
/.tauri
12+
/target
13+
Cargo.lock
14+
node_modules/
15+
16+
dist-js
17+
dist

0 commit comments

Comments
 (0)