feat: add si command line interface
#37
Generated
+2
@@ -7203,6 +7203,7 @@ dependencies = [
|
|||||||
"gpui",
|
"gpui",
|
||||||
"gpui_platform",
|
"gpui_platform",
|
||||||
"metadata",
|
"metadata",
|
||||||
|
"paths",
|
||||||
"reqwest_client",
|
"reqwest_client",
|
||||||
"rust-embed",
|
"rust-embed",
|
||||||
"settings",
|
"settings",
|
||||||
@@ -7243,6 +7244,7 @@ dependencies = [
|
|||||||
"gpui",
|
"gpui",
|
||||||
"gpui_platform",
|
"gpui_platform",
|
||||||
"nostr",
|
"nostr",
|
||||||
|
"paths",
|
||||||
"rpassword",
|
"rpassword",
|
||||||
"settings",
|
"settings",
|
||||||
"signed_core",
|
"signed_core",
|
||||||
|
|||||||
@@ -13,14 +13,17 @@ signed_core = { path = "../signed_core" }
|
|||||||
signed_git = { path = "../signed_git" }
|
signed_git = { path = "../signed_git" }
|
||||||
signed_state = { path = "../signed_state" }
|
signed_state = { path = "../signed_state" }
|
||||||
settings = { path = "../settings" }
|
settings = { path = "../settings" }
|
||||||
|
paths = { path = "../paths" }
|
||||||
|
|
||||||
|
rpassword = "7"
|
||||||
|
clap = { version = "4", features = ["derive"] }
|
||||||
|
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
gpui_platform.workspace = true
|
gpui_platform.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
clap = { version = "4", features = ["derive"] }
|
|
||||||
flume.workspace = true
|
flume.workspace = true
|
||||||
nostr.workspace = true
|
nostr.workspace = true
|
||||||
rpassword = "7"
|
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
|
|
||||||
|
|||||||
@@ -7,14 +7,12 @@ use clap::{Args, Parser, Subcommand};
|
|||||||
use gpui::{App, AsyncApp, Entity, Subscription};
|
use gpui::{App, AsyncApp, Entity, Subscription};
|
||||||
use nostr::nips::nip19::Nip19Coordinate;
|
use nostr::nips::nip19::Nip19Coordinate;
|
||||||
use nostr::prelude::{PublicKey, RelayUrl, ToBech32 as _};
|
use nostr::prelude::{PublicKey, RelayUrl, ToBech32 as _};
|
||||||
|
use paths::APP_ID;
|
||||||
use settings::{DEFAULT_GRASP_SERVERS, SettingsStore};
|
use settings::{DEFAULT_GRASP_SERVERS, SettingsStore};
|
||||||
use signed_core::{Announcement, RepoAddr};
|
use signed_core::{Announcement, RepoAddr};
|
||||||
use signed_git::{GitCache, Repo};
|
use signed_git::{GitCache, Repo};
|
||||||
use signed_state::{Backend, BackendEvent, CheckoutsStore};
|
use signed_state::{Backend, BackendEvent, CheckoutsStore};
|
||||||
|
|
||||||
/// The desktop app's bundle identifier, the packager `identifier` in `desktop/Cargo.toml`.
|
|
||||||
const DESKTOP_BUNDLE_ID: &str = "info.reya.signed";
|
|
||||||
|
|
||||||
/// Command line interface for Signed.
|
/// Command line interface for Signed.
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(name = "si", version, about)]
|
#[command(name = "si", version, about)]
|
||||||
@@ -156,7 +154,7 @@ fn open_desktop() -> anyhow::Result<()> {
|
|||||||
if cfg!(target_os = "macos") {
|
if cfg!(target_os = "macos") {
|
||||||
// Launch Services finds the app by its bundle identifier wherever it is installed.
|
// Launch Services finds the app by its bundle identifier wherever it is installed.
|
||||||
let status = std::process::Command::new("open")
|
let status = std::process::Command::new("open")
|
||||||
.args(["-b", DESKTOP_BUNDLE_ID])
|
.args(["-b", APP_ID])
|
||||||
.status()
|
.status()
|
||||||
.context("failed to launch the desktop app")?;
|
.context("failed to launch the desktop app")?;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ use std::sync::LazyLock;
|
|||||||
|
|
||||||
/// The application name, which derives the platform-specific directory paths.
|
/// The application name, which derives the platform-specific directory paths.
|
||||||
pub const APP_NAME: &str = "Signed";
|
pub const APP_NAME: &str = "Signed";
|
||||||
|
/// The application's platform identifier, the packager `identifier` in `desktop/Cargo.toml`.
|
||||||
|
pub const APP_ID: &str = "build.signed.signed";
|
||||||
/// Lowercased [`APP_NAME`], used in XDG paths and the macOS `~/.config` fallback.
|
/// Lowercased [`APP_NAME`], used in XDG paths and the macOS `~/.config` fallback.
|
||||||
pub const APP_NAME_LOWERCASE: &str = "signed";
|
pub const APP_NAME_LOWERCASE: &str = "signed";
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ pub fn init(cx: &mut App) -> anyhow::Result<()> {
|
|||||||
if backend.is_ok() {
|
if backend.is_ok() {
|
||||||
cx.show_system_notification(gpui::SystemNotification {
|
cx.show_system_notification(gpui::SystemNotification {
|
||||||
tag: "signed-nostr-db".into(),
|
tag: "signed-nostr-db".into(),
|
||||||
title: "Nostr cache unavailable".into(),
|
title: "Nostr Storage unavailable".into(),
|
||||||
body: format!(
|
body: format!(
|
||||||
"{} could not be opened; this session uses a temporary cache",
|
"{} could not be opened, this session uses a temporary storage",
|
||||||
db_path.display()
|
db_path.display()
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ icons = [
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
metadata = { path = "../crates/metadata" }
|
metadata = { path = "../crates/metadata" }
|
||||||
|
paths = { path = "../crates/paths" }
|
||||||
settings = { path = "../crates/settings" }
|
settings = { path = "../crates/settings" }
|
||||||
signed_app = { path = "../crates/signed_app" }
|
signed_app = { path = "../crates/signed_app" }
|
||||||
signed_state = { path = "../crates/signed_state" }
|
signed_state = { path = "../crates/signed_state" }
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ fn main() {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
cx.on_action(|_: &Quit, cx| cx.quit());
|
cx.on_action(|_: &Quit, cx| cx.quit());
|
||||||
cx.set_app_identity("build.signed.signed", "Signed");
|
cx.set_app_identity(paths::APP_ID, paths::APP_NAME);
|
||||||
|
|
||||||
ui::init(cx);
|
ui::init(cx);
|
||||||
metadata::init(cx);
|
metadata::init(cx);
|
||||||
|
|||||||
Reference in New Issue
Block a user