1use crate::runners::CommandType;
5
6#[inline]
7pub fn set_args(
8 mut cmd: std::process::Command,
9 _file_path: &std::path::Path,
10) -> std::process::Command {
11 cmd.arg("fmt");
12 cmd.arg("--stdin");
13 cmd
14}
15
16pub const COMMANDS: [CommandType; 7] = [
17 CommandType::NodeModules("mise"),
18 CommandType::Direct("mise"),
19 CommandType::Npm("@jdxcode/mise"),
20 CommandType::Pnpm("@jdxcode/mise"),
21 CommandType::Bun("@jdxcode/mise"),
22 CommandType::Deno("@jdxcode/mise"),
23 CommandType::Yarn("@jdxcode/mise"),
24];
25
26pub const IS_STDIN: bool = true;
27
28#[cfg(test)]
29mod test_mise_fmt {
30 #[test_with::executable(mise || npx || pnpm || deno || bunx)]
31 fn test_mise_fmt_toml_7a3c9e91cda91a26() {
32 let input = r#"[env]
33NODE_ENV = 'production'
34
35
36[tools]
37erlang = ['23.3', '24.0']
38terraform = '1.0.0'
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53[tasks.build]
54run = 'echo "running build tasks"'
55"#;
56
57 let output = r#"[env]
58NODE_ENV = 'production'
59
60
61[tools]
62erlang = ['23.3', '24.0']
63terraform = '1.0.0'
64
65
66[tasks.build]
67run = 'echo "running build tasks"'
68"#;
69
70 let file_ext = crate::fttype::get_file_extension("toml");
71
72 let snippet =
73 crate::execution::setup_snippet(input, &file_ext).expect("it to create a snippet file");
74
75 let result = crate::tools::Tooling::MiseFmt
76 .format_snippet(
77 snippet.path(),
78 crate::testing::DEFAULT_TEST_FORMATTER_TIMEOUT,
79 crate::testing::DEFAULT_TEST_DEBUG_ENABLED,
80 &crate::config::MdsfConfigRunners::all(),
81 )
82 .expect("it to be successful")
83 .1
84 .expect("it to be some");
85
86 assert_eq!(result, output);
87 }
88}