refactor: show help when running si with no command
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s
Rust / build (macos-latest, stable) (pull_request) Canceled after 0s
Rust / build (windows-latest, stable) (pull_request) Canceled after 0s
Rust / build (ubuntu-latest, stable) (pull_request) Canceled after 0s
This commit is contained in:
@@ -18,7 +18,6 @@ signed_app = { path = "crates/signed_app" }
|
||||
|
||||
nostr = { git = "https://github.com/rust-nostr/nostr", features = ["nip59", "nip49", "nip44", "os-rng"] }
|
||||
nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" }
|
||||
nostr-blossom = { git = "https://github.com/rust-nostr/nostr" }
|
||||
nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr" }
|
||||
nostr-connect = { git = "https://github.com/rust-nostr/nostr" }
|
||||
nostr-sdk = { git = "https://github.com/rust-nostr/nostr" }
|
||||
@@ -27,20 +26,16 @@ gix = { version = "0.88", default-features = false, features = ["sha1", "blockin
|
||||
|
||||
jiff = "0.2"
|
||||
|
||||
smol = "2"
|
||||
futures = "0.3"
|
||||
flume = { version = "0.11.1", default-features = false, features = ["async", "select"] }
|
||||
rust-embed = { version = "8.5", features = ["include-exclude"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
schemars = "1"
|
||||
log = "0.4"
|
||||
anyhow = "1.0.44"
|
||||
webbrowser = "1.0.4"
|
||||
tracing-subscriber = { version = "0.3.18", features = ["fmt"] }
|
||||
tracing = "0.1"
|
||||
errno = { version = "0.3.14", default-features = false }
|
||||
instant = "0.1"
|
||||
|
||||
[profile.release]
|
||||
strip = true
|
||||
|
||||
@@ -12,7 +12,7 @@ path = "src/main.rs"
|
||||
signed_core = { path = "../signed_core" }
|
||||
signed_git = { path = "../signed_git" }
|
||||
signed_state = { path = "../signed_state" }
|
||||
settings = { path = "../settings" }
|
||||
settings.workspace = true
|
||||
paths = { path = "../paths" }
|
||||
|
||||
rpassword = "7"
|
||||
|
||||
+13
-3
@@ -3,7 +3,7 @@ use std::path::{Path, PathBuf};
|
||||
use std::process::Stdio;
|
||||
|
||||
use anyhow::{Context as _, bail};
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
use clap::{Args, CommandFactory as _, Parser, Subcommand};
|
||||
use gpui::{App, AsyncApp, Entity, Subscription};
|
||||
use nostr::nips::nip19::Nip19Coordinate;
|
||||
use nostr::prelude::{PublicKey, RelayUrl, ToBech32 as _};
|
||||
@@ -18,7 +18,7 @@ use signed_state::{Backend, BackendEvent, CheckoutsStore};
|
||||
#[command(name = "si", version, about)]
|
||||
struct Cli {
|
||||
#[command(subcommand)]
|
||||
command: Command,
|
||||
command: Option<Command>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
@@ -98,12 +98,22 @@ fn main() {
|
||||
|
||||
let cli = Cli::parse();
|
||||
|
||||
// A bare `si` lists the commands instead of failing.
|
||||
let Some(command) = cli.command else {
|
||||
if let Err(error) = Cli::command().print_help() {
|
||||
eprintln!("error: failed to write help: {error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
return;
|
||||
};
|
||||
|
||||
gpui_platform::headless().run(move |cx| {
|
||||
// The callback runs before the platform's run loop, so the command awaits inside a foreground task.
|
||||
cx.spawn(async move |cx| {
|
||||
let mut code = 0;
|
||||
|
||||
if let Err(error) = run(cli.command, cx).await {
|
||||
if let Err(error) = run(command, cx).await {
|
||||
eprintln!("error: {error:#}");
|
||||
code = 1;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ publish.workspace = true
|
||||
[dependencies]
|
||||
metadata = { path = "../metadata" }
|
||||
paths = { path = "../paths" }
|
||||
settings = { path = "../settings" }
|
||||
settings.workspace = true
|
||||
signed_core = { path = "../signed_core" }
|
||||
signed_git = { path = "../signed_git" }
|
||||
signed_nostr = { path = "../signed_nostr" }
|
||||
|
||||
@@ -8,7 +8,7 @@ publish.workspace = true
|
||||
signed_core = { path = "../signed_core" }
|
||||
signed_git = { path = "../signed_git" }
|
||||
signed_nostr = { path = "../signed_nostr" }
|
||||
settings = { path = "../settings" }
|
||||
settings.workspace = true
|
||||
paths = { path = "../paths" }
|
||||
utils = { path = "../utils" }
|
||||
|
||||
|
||||
+2
-2
@@ -29,8 +29,8 @@ icons = [
|
||||
[dependencies]
|
||||
metadata = { path = "../crates/metadata" }
|
||||
paths = { path = "../crates/paths" }
|
||||
settings = { path = "../crates/settings" }
|
||||
signed_app = { path = "../crates/signed_app" }
|
||||
settings.workspace = true
|
||||
signed_app.workspace = true
|
||||
signed_state = { path = "../crates/signed_state" }
|
||||
|
||||
gpui.workspace = true
|
||||
|
||||
Reference in New Issue
Block a user