Skip to content

Commit b8ed785

Browse files
committed
fix: show usage instead of panic when addr missing
1 parent e5998c0 commit b8ed785

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = [".", "tests/test_plugin"]
33

44
[package]
55
name = "http-nu"
6-
version = "0.10.0"
6+
version = "0.10.1-dev"
77
edition = "2021"
88
rust-version = "1.88.0"
99
description = "The surprisingly performant, Datastar-ready, Nushell-scriptable HTTP server that fits in your back pocket."

src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
526526
}
527527

528528
// Server mode (default)
529-
let addr = args.addr.expect("addr required for server mode");
529+
let Some(addr) = args.addr else {
530+
eprintln!("Usage: http-nu <ADDR> [OPTIONS]");
531+
eprintln!(" http-nu eval [OPTIONS]");
532+
eprintln!("\nRun `http-nu --help` for more information.");
533+
std::process::exit(1);
534+
};
530535

531536
// Create cross.stream store if --store is specified
532537
#[cfg(feature = "cross-stream")]

0 commit comments

Comments
 (0)