Skip to content

feat: add check flag for the fmt command#4972

Merged
jdx merged 2 commits intojdx:mainfrom
roele:issues/4841
May 1, 2025
Merged

feat: add check flag for the fmt command#4972
jdx merged 2 commits intojdx:mainfrom
roele:issues/4841

Conversation

@roele
Copy link
Copy Markdown
Contributor

@roele roele commented Apr 30, 2025

Add a --check flag for the fmt command. When set no formatting is done.

While adding this i wondered what the following should do. This does most likely not work as intended as the sort_values_by clearly states that it does NOT operate on header keys as the ordering in the order closure suggests.

mise/src/cli/fmt.rs

Lines 65 to 84 in 576014f

let mut doc: toml_edit::DocumentMut = toml.parse()?;
let order = |k: String| match k.as_str() {
"min_version" => 0,
"env_file" => 1,
"env_path" => 2,
"_" => 3,
"env" => 4,
"vars" => 5,
"hooks" => 6,
"watch_files" => 7,
"tools" => 8,
"tasks" => 10,
"task_config" => 11,
"redactions" => 12,
"alias" => 13,
"plugins" => 14,
"settings" => 15,
_ => 9,
};
doc.sort_values_by(|a, _, b, _| order(a.to_string()).cmp(&order(b.to_string())));

@jdx jdx enabled auto-merge (squash) April 30, 2025 11:36
auto-merge was automatically disabled May 1, 2025 07:57

Head branch was pushed to by a user without write access

@jdx jdx merged commit 0e36c10 into jdx:main May 1, 2025
19 checks passed
@roele roele deleted the issues/4841 branch May 3, 2025 10:42
jdx pushed a commit that referenced this pull request May 3, 2025
### 🚀 Features

- **(registry)** add luau by [@rhanneken](https://github.com/rhanneken)
in [#4993](#4993)
- **(registry)** add numbat by [@risu729](https://github.com/risu729) in
[#4980](#4980)
- add check flag for the fmt command by
[@roele](https://github.com/roele) in
[#4972](#4972)
- use aqua for btop by [@jdx](https://github.com/jdx) in
[#4979](#4979)

### 🐛 Bug Fixes

- **(java)** filter out JetBrains releases with features by
[@roele](https://github.com/roele) in
[#4970](#4970)
- fix deadlocks caused by uv_venv_auto by
[@risu729](https://github.com/risu729) in
[#4900](#4900)

### 📚 Documentation

- Put dot in dotfile example by
[@ryanbrainard](https://github.com/ryanbrainard) in
[#4965](#4965)

### Chore

- only use mold when available by [@jdx](https://github.com/jdx) in
[#4978](#4978)
- enable clearing screen for confirm and dialog by
[@roele](https://github.com/roele) in
[#4990](#4990)

### New Contributors

- @rhanneken made their first contribution in
[#4993](#4993)
- @ryanbrainard made their first contribution in
[#4965](#4965)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants