SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
vector: accept Go-style single-dash long flags (#12247)
Chris Lua1f288664725
diff --git a/seaweed-vector/crates/server/src/main.rs b/seaweed-vector/crates/server/src/main.rsindex de52878e47..15adc1047f 100644--- a/seaweed-vector/crates/server/src/main.rs+++ b/seaweed-vector/crates/server/src/main.rs@@ -21,11 +21,11 @@ struct Args {listen: String,/// object_store option fallback for deployments that vend no credentials:/// key=value, repeatable.- #[arg(long = "storage-option", value_parser = parse_option)]+ #[arg(long = "storage-option", alias = "storage.option", value_parser = parse_option)]storage_options: Vec<(String, String)>,/// Comma-separated master addresses to register this server with; the/// gateway discovers it via ListClusterNodes(client_type=vector).- #[arg(long, env = "WEED_VECTOR_MASTERS")]+ #[arg(long, alias = "master", env = "WEED_VECTOR_MASTERS")]masters: Option<String>,}@@ -35,6 +35,31 @@ fn parse_option(s: &str) -> Result<(String, String), String> {.ok_or_else(|| "expected key=value".to_string())}+// weed tools take Go-style single-dash long flags; normalize_args converts+// any -flag to --flag — the same normalization weed-volume's config.rs does —+// so -master and --masters parse the same. The masters field carries the+// singular alias clap-side.+fn normalize_args(args: Vec<String>) -> Vec<String> {+ let mut args = args;+ let mut i = 1; // skip args[0] (binary name)+ while i < args.len() {+ let arg = &args[i];+ if arg == "--" {+ break;+ }+ if arg.starts_with("--") || !arg.starts_with('-') {+ i += 1;+ continue;+ }+ let without_dash = &arg[1..];+ if without_dash.len() > 1 && !without_dash.starts_with(|c: char| c.is_ascii_digit()) {+ args[i] = format!("-{}", arg);+ }+ i += 1;+ }+ args+}+/// A wildcard listen address is not reachable for peers; derive the outbound/// IP toward the first master instead — the address the master sees anyway.fn advertised_addr(listen: &str, masters: &[String]) -> String {@@ -73,7 +98,7 @@ fn advertised_addr(listen: &str, masters: &[String]) -> String {#[tokio::main]async fn main() -> Result<()> {tracing_subscriber::fmt::init();- let args = Args::parse();+ let args = Args::parse_from(normalize_args(std::env::args().collect()));if let Some(masters) = &args.masters {let masters: Vec<String> = masters.split(',').map(|s| s.trim().to_string()).collect();let advertise = advertised_addr(&args.listen, &masters);