From 877782a8a41d830f9e7f0f22dfcb67b3c2e50418 Mon Sep 17 00:00:00 2001 From: Will Lillis Date: Sat, 1 Nov 2025 05:25:00 -0400 Subject: [PATCH] fix(docs): update cli docs to reflect changes to various subcommand arguments --- crates/cli/src/main.rs | 11 +++-------- docs/src/cli/fuzz.md | 12 ++++++++++++ docs/src/cli/generate.md | 6 +++++- docs/src/cli/highlight.md | 4 ++++ docs/src/cli/parse.md | 14 +++++++++++--- docs/src/cli/playground.md | 8 ++++---- docs/src/cli/query.md | 12 ++++++++++++ docs/src/cli/tags.md | 4 ++++ docs/src/cli/test.md | 12 ++++++++++++ docs/src/cli/version.md | 8 ++++++++ 10 files changed, 75 insertions(+), 16 deletions(-) diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index d9f8c174..1c7fa957 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -261,15 +261,10 @@ struct Parse { #[arg(long)] pub open_log: bool, /// Deprecated: use --json-summary - #[arg( - long, - short = 'j', - conflicts_with = "json_summary", - conflicts_with = "stat" - )] + #[arg(long, conflicts_with = "json_summary", conflicts_with = "stat")] pub json: bool, /// Output parsing results in a JSON format - #[arg(long, conflicts_with = "json", conflicts_with = "stat")] + #[arg(long, short = 'j', conflicts_with = "json", conflicts_with = "stat")] pub json_summary: bool, /// The path to an alternative config.json file #[arg(long)] @@ -348,7 +343,7 @@ struct Test { /// Show only the pass-fail overview tree #[arg(long)] pub overview_only: bool, - /// Output the test summary in a JSON output + /// Output the test summary in a JSON format #[arg(long)] pub json_summary: bool, } diff --git a/docs/src/cli/fuzz.md b/docs/src/cli/fuzz.md index 1f79bc00..7f97f9ba 100644 --- a/docs/src/cli/fuzz.md +++ b/docs/src/cli/fuzz.md @@ -17,6 +17,18 @@ A list of test names to skip fuzzing. The directory containing the parser. This is primarily useful in multi-language repositories. +### `-p/--grammar-path` + +The path to the directory containing the grammar. + +### `--lib-path` + +The path to the parser's dynamic library. This is used instead of the cached or automatically generated dynamic library. + +### `--lang-name` + +If `--lib-path` is used, the name of the language used to extract the library's language function + ### `--edits ` The maximum number of edits to perform. The default is 3. diff --git a/docs/src/cli/generate.md b/docs/src/cli/generate.md index 32c8437a..c373b1e2 100644 --- a/docs/src/cli/generate.md +++ b/docs/src/cli/generate.md @@ -44,7 +44,7 @@ Print the overview of states from the given rule. This is useful for debugging a item sets for all given states in a given rule. To solely view state count numbers for rules, pass in `-` for the rule argument. To view the overview of states for every rule, pass in `*` for the rule argument. -### `--json` +### `--json-summary` Report conflicts in a JSON format. @@ -54,3 +54,7 @@ The path to the JavaScript runtime executable to use when generating the parser. Note that you can also set this with `TREE_SITTER_JS_RUNTIME`. Starting from version 0.26.0, you can also pass in `native` to use the native QuickJS runtime that comes bundled with the CLI. This avoids the dependency on a JavaScript runtime entirely. + +### `--disable-optimization` + +Disable optimizations when generating the parser. Currently, this only affects the merging of compatible parse states. diff --git a/docs/src/cli/highlight.md b/docs/src/cli/highlight.md index 1378e0f6..82c9e25c 100644 --- a/docs/src/cli/highlight.md +++ b/docs/src/cli/highlight.md @@ -57,3 +57,7 @@ The path to an alternative configuration (`config.json`) file. See [the init-con ### `-n/--test-number ` Highlight the contents of a specific test. + +### `-r/--rebuild` + +Force a rebuild of the parser before running the fuzzer. diff --git a/docs/src/cli/parse.md b/docs/src/cli/parse.md index 9f76b550..178d97b5 100644 --- a/docs/src/cli/parse.md +++ b/docs/src/cli/parse.md @@ -1,8 +1,8 @@ # `tree-sitter parse` The `parse` command parses source files using a Tree-sitter parser. You can pass any number of file paths and glob patterns -to `tree-sitter parse`, and it will parse all the given files. The command will exit with a non-zero status code if any -parse errors occurred. +to `tree-sitter parse`, and it will parse all the given files. If no paths are provided, input will be parsed from stdin. +The command will exit with a non-zero status code if any parse errors occurred. ```bash tree-sitter parse [OPTIONS] [PATHS]... # Aliases: p @@ -18,6 +18,14 @@ The path to a file that contains paths to source files to parse. The path to the directory containing the grammar. +### `-l/--lib-path` + +The path to the parser's dynamic library. This is used instead of the cached or automatically generated dynamic library. + +### `--lang-name` + +If `--lib-path` is used, the name of the language used to extract the library's language function + ### `--scope ` The language scope to use for parsing. This is useful when the language is ambiguous. @@ -81,7 +89,7 @@ in `UTF-16BE` or `UTF-16LE`. If no `BOM` is present, `UTF-8` is the default. One When using the `--debug-graph` option, open the log file in the default browser. -### `-j/--json` +### `-j/--json-summary` Output parsing results in a JSON format. diff --git a/docs/src/cli/playground.md b/docs/src/cli/playground.md index 0dbff469..7c2ef598 100644 --- a/docs/src/cli/playground.md +++ b/docs/src/cli/playground.md @@ -13,10 +13,6 @@ For this to work, you must have already built the parser as a Wasm module. This ## Options -### `-e/--export ` - -Export static playground files to the specified directory instead of serving them. - ### `-q/--quiet` Don't automatically open the playground in the default browser. @@ -24,3 +20,7 @@ Don't automatically open the playground in the default browser. ### `--grammar-path ` The path to the directory containing the grammar and wasm files. + +### `-e/--export ` + +Export static playground files to the specified directory instead of serving them. diff --git a/docs/src/cli/query.md b/docs/src/cli/query.md index ed96aa51..395ca486 100644 --- a/docs/src/cli/query.md +++ b/docs/src/cli/query.md @@ -12,6 +12,14 @@ tree-sitter query [OPTIONS] [PATHS]... # Aliases: q The path to the directory containing the grammar. +### `--lib-path` + +The path to the parser's dynamic library. This is used instead of the cached or automatically generated dynamic library. + +### `--lang-name` + +If `--lib-path` is used, the name of the language used to extract the library's language function + ### `-t/--time` Print the time taken to execute the query on the file. @@ -51,3 +59,7 @@ The path to an alternative configuration (`config.json`) file. See [the init-con ### `-n/--test-number ` Query the contents of a specific test. + +### `-r/--rebuild` + +Force a rebuild of the parser before executing the query. diff --git a/docs/src/cli/tags.md b/docs/src/cli/tags.md index 80ee1baa..a48fabb4 100644 --- a/docs/src/cli/tags.md +++ b/docs/src/cli/tags.md @@ -36,3 +36,7 @@ The path to an alternative configuration (`config.json`) file. See [the init-con ### `-n/--test-number ` Generate tags from the contents of a specific test. + +### `-r/--rebuild` + +Force a rebuild of the parser before running the tags. diff --git a/docs/src/cli/test.md b/docs/src/cli/test.md index c1724745..401bcd39 100644 --- a/docs/src/cli/test.md +++ b/docs/src/cli/test.md @@ -24,6 +24,14 @@ Only run tests from the given filename in the corpus. The path to the directory containing the grammar. +### `--lib-path` + +The path to the parser's dynamic library. This is used instead of the cached or automatically generated dynamic library. + +### `--lang-name` + +If `--lib-path` is used, the name of the language used to extract the library's language function + ### `-u/--update` Update the expected output of tests. @@ -78,3 +86,7 @@ Force a rebuild of the parser before running tests. ### `--overview-only` Only show the overview of the test results, and not the diff. + +### `--json-summary` + +Output the test summary in a JSON format. diff --git a/docs/src/cli/version.md b/docs/src/cli/version.md index e8f7a840..ab699d2a 100644 --- a/docs/src/cli/version.md +++ b/docs/src/cli/version.md @@ -42,3 +42,11 @@ tree-sitter version ### `-p/--grammar-path ` The path to the directory containing the grammar. + +### `--bump` + +Automatically bump the version. Possible values are: + +- `patch`: Bump the patch version. +- `minor`: Bump the minor version. +- `major`: Bump the major version.