mirror of
https://github.com/numtide/treefmt.git
synced 2024-09-11 17:07:44 +03:00
parent
405d83ae5e
commit
6b2d6fca2f
@ -8,22 +8,7 @@ use std::path::Path;
|
||||
pub fn init_cmd(work_dir: &Path) -> anyhow::Result<()> {
|
||||
let file_path = work_dir.join(config::FILENAME);
|
||||
// TODO: detect if file exists
|
||||
fs::write(
|
||||
&file_path,
|
||||
r#"# One CLI to format the code tree - https://github.com/numtide/treefmt
|
||||
|
||||
[formatter.mylanguage]
|
||||
# Formatter to run
|
||||
command = "command-to-run"
|
||||
# Command-line arguments for the command
|
||||
options = []
|
||||
# Glob pattern of files to include
|
||||
includes = [ "*.<language-extension>" ]
|
||||
# Glob patterns of files to exclude
|
||||
excludes = []
|
||||
"#,
|
||||
)
|
||||
.with_context(|| {
|
||||
fs::write(&file_path, std::include_bytes!("init_treefmt.toml")).with_context(|| {
|
||||
format!(
|
||||
"{} `{}`",
|
||||
style("Error writing").bold().red(),
|
||||
|
11
src/command/init_treefmt.toml
Normal file
11
src/command/init_treefmt.toml
Normal file
@ -0,0 +1,11 @@
|
||||
# One CLI to format the code tree - https://github.com/numtide/treefmt
|
||||
|
||||
[formatter.mylanguage]
|
||||
# Formatter to run
|
||||
command = "command-to-run"
|
||||
# Command-line arguments for the command
|
||||
options = []
|
||||
# Glob pattern of files to include
|
||||
includes = [ "*.<language-extension>" ]
|
||||
# Glob patterns of files to exclude
|
||||
excludes = []
|
Loading…
Reference in New Issue
Block a user