diff --git a/README.md b/README.md index 91cb9b9..855617f 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ strings — are reformatted, always into a vertical block: quotes on their own lines, one clause per line. Plain single-line strings stay byte-identical, and so do Python f-strings and `${}`-interpolated templates (SQL with holes is never touched). Directories include host -files with `--embed`; `--embed-query custom.scm` swaps the tree-sitter +files with `--embedded`; `--embedded-query custom.scm` swaps the tree-sitter extraction query. ## Design diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index e8aac7d..226f051 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -37,10 +37,10 @@ Options: --quote-idents unquote-safe (default) | always --at-params Treat sqlc-style @name as parameters (Postgres) --no-config Ignore squill.toml files - --embed Also format SQL embedded in host files (.rs, + --embedded Also format SQL embedded in host files (.rs, .go, .py, .js/.ts/.tsx, .gleam) when recursing directories (explicit host paths always format) - --embed-query Override the tree-sitter extraction query + --embedded-query Override the tree-sitter extraction query -h, --help Show this help Configuration: the nearest squill.toml at or above each formatted file @@ -90,12 +90,12 @@ fn parse_args() -> Result { "--stdin" => args.stdin_mode = true, "--strict" => args.strict = true, "--no-config" => args.no_config = true, - "--embed" => args.embed = true, - "--embed-query" => { - let path = value(&mut argv, "--embed-query")?; + "--embedded" => args.embed = true, + "--embedded-query" => { + let path = value(&mut argv, "--embedded-query")?; args.embed_query = Some( std::fs::read_to_string(&path) - .map_err(|err| format!("--embed-query {path}: {err}"))?, + .map_err(|err| format!("--embedded-query {path}: {err}"))?, ); } "--at-params" => args.overrides.at_params = Some(true), diff --git a/crates/cli/tests/cli.rs b/crates/cli/tests/cli.rs index c256fde..61935cf 100644 --- a/crates/cli/tests/cli.rs +++ b/crates/cli/tests/cli.rs @@ -368,7 +368,7 @@ fn directory_recursion_needs_embed_flag() { std::fs::write(dir.join("q.rs"), RS_FIXTURE).expect("write"); std::fs::write(dir.join("plain.sql"), "SELECT 1;\n").expect("write"); - // Without --embed: only the .sql file changes. + // Without --embedded: only the .sql file changes. let status = squill().arg("fmt").arg(&dir).status().expect("run"); assert!(status.success()); assert_eq!( @@ -380,9 +380,9 @@ fn directory_recursion_needs_embed_flag() { "select 1;\n" ); - // With --embed: the .rs file formats too, and --check is then clean. + // With --embedded: the .rs file formats too, and --check is then clean. let status = squill() - .args(["fmt", "--embed"]) + .args(["fmt", "--embedded"]) .arg(&dir) .status() .expect("run"); @@ -393,11 +393,14 @@ fn directory_recursion_needs_embed_flag() { .contains("select id, name\n from users"), ); let status = squill() - .args(["fmt", "--embed", "--check"]) + .args(["fmt", "--embedded", "--check"]) .arg(&dir) .status() .expect("run"); - assert!(status.success(), "--check after --embed fmt must be clean"); + assert!( + status.success(), + "--check after --embedded fmt must be clean" + ); let _ = std::fs::remove_dir_all(&dir); } @@ -453,7 +456,7 @@ fn custom_embed_query_file() { ) .expect("write"); let status = squill() - .args(["fmt", "--embed-query"]) + .args(["fmt", "--embedded-query"]) .arg(dir.join("only_mine.scm")) .arg(&file) .status()