Skip to content

Commit d784a47

Browse files
committed
Add documentation about prek.toml (#1560)
update schema url
1 parent 670dee8 commit d784a47

5 files changed

Lines changed: 650 additions & 189 deletions

File tree

crates/prek/src/cli/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,11 @@ pub(crate) struct ValidateManifestArgs {
591591
#[expect(clippy::option_option)]
592592
#[derive(Debug, Args)]
593593
pub(crate) struct SampleConfigArgs {
594-
/// Write the sample config to a file (`.pre-commit-config.yaml` by default).
594+
/// Write the sample config to a file.
595+
///
596+
/// Defaults to `.pre-commit-config.yaml` unless `--format toml` is set,
597+
/// which uses `prek.toml`. If a path is provided without `--format`,
598+
/// the format is inferred from the file extension (`.toml` uses TOML).
595599
#[arg(
596600
short,
597601
long,

crates/prek/src/cli/sample_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
"};
2525

2626
static SAMPLE_CONFIG_TOML: &str = indoc::indoc! {r#"
27-
#:schema: https://prek.j178.dev/prek.schema.json
27+
#:schema: https://json.schemastore.org/prek.json
2828
# Configuration file for `prek`, a git hook framework written in Rust.
2929
# See https://prek.j178.dev for more information.
3030

crates/prek/tests/sample_config.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fn sample_config_toml() {
112112
"#);
113113

114114
insta::assert_snapshot!(context.read("prek.toml"), @r#"
115-
#:schema: https://prek.j178.dev/prek.schema.json
115+
#:schema: https://json.schemastore.org/prek.json
116116
# Configuration file for `prek`, a git hook framework written in Rust.
117117
# See https://prek.j178.dev for more information.
118118
@@ -134,7 +134,7 @@ fn sample_config_format() {
134134
success: true
135135
exit_code: 0
136136
----- stdout -----
137-
#:schema: https://prek.j178.dev/prek.schema.json
137+
#:schema: https://json.schemastore.org/prek.json
138138
# Configuration file for `prek`, a git hook framework written in Rust.
139139
# See https://prek.j178.dev for more information.
140140
@@ -224,7 +224,7 @@ fn respect_format_if_filename_missing() {
224224
");
225225

226226
insta::assert_snapshot!(context.read("prek.toml"), @r#"
227-
#:schema: https://prek.j178.dev/prek.schema.json
227+
#:schema: https://json.schemastore.org/prek.json
228228
# Configuration file for `prek`, a git hook framework written in Rust.
229229
# See https://prek.j178.dev for more information.
230230

docs/cli.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,8 @@ prek sample-config [OPTIONS]
549549
<li><code>always</code>: Enables colored output regardless of the detected environment</li>
550550
<li><code>never</code>: Disables colored output</li>
551551
</ul></dd><dt id="prek-sample-config--config"><a href="#prek-sample-config--config"><code>--config</code></a>, <code>-c</code> <i>config</i></dt><dd><p>Path to alternate config file</p>
552-
</dd><dt id="prek-sample-config--file"><a href="#prek-sample-config--file"><code>--file</code></a>, <code>-f</code> <i>file</i></dt><dd><p>Write the sample config to a file (<code>.pre-commit-config.yaml</code> by default)</p>
552+
</dd><dt id="prek-sample-config--file"><a href="#prek-sample-config--file"><code>--file</code></a>, <code>-f</code> <i>file</i></dt><dd><p>Write the sample config to a file.</p>
553+
<p>Defaults to <code>.pre-commit-config.yaml</code> unless <code>--format toml</code> is set, which uses <code>prek.toml</code>. If a path is provided without <code>--format</code>, the format is inferred from the file extension (<code>.toml</code> uses TOML).</p>
553554
</dd><dt id="prek-sample-config--format"><a href="#prek-sample-config--format"><code>--format</code></a> <i>format</i></dt><dd><p>Select the sample configuration format</p>
554555
<p>Possible values:</p>
555556
<ul>

0 commit comments

Comments
 (0)