File tree 7 files changed +39
-9
lines changed
7 files changed +39
-9
lines changed Original file line number Diff line number Diff line change 605
605
''^tests/functional/flakes/prefetch\.sh$''
606
606
''^tests/functional/flakes/run\.sh$''
607
607
''^tests/functional/flakes/show\.sh$''
608
- ''^tests/functional/fmt \.sh$''
609
- ''^tests/functional/fmt \.simple\.sh$''
608
+ ''^tests/functional/formatter \.sh$''
609
+ ''^tests/functional/formatter \.simple\.sh$''
610
610
''^tests/functional/gc-auto\.sh$''
611
611
''^tests/functional/gc-concurrent\.builder\.sh$''
612
612
''^tests/functional/gc-concurrent\.sh$''
Original file line number Diff line number Diff line change 2
2
3
3
# Description
4
4
5
- ` nix fmt ` calls the formatter specified in the flake.
5
+ ` nix fmt ` (an alias for ` nix formatter run ` ) calls the formatter specified in the flake.
6
6
7
7
Flags can be forwarded to the formatter by using ` -- ` followed by the flags.
8
8
Original file line number Diff line number Diff line change 5
5
6
6
using namespace nix ;
7
7
8
- struct CmdFmt : SourceExprCommand {
8
+ struct CmdFormatter : NixMultiCommand
9
+ {
10
+ CmdFormatter ()
11
+ : NixMultiCommand(" formatter" , RegisterCommand::getCommandsFor({" formatter" }))
12
+ {
13
+ }
14
+
15
+ std::string description () override
16
+ {
17
+ return " build or run the formatter" ;
18
+ }
19
+
20
+ Category category () override
21
+ {
22
+ return catSecondary;
23
+ }
24
+ };
25
+
26
+ static auto rCmdFormatter = registerCommand<CmdFormatter>(" formatter" );
27
+
28
+ struct CmdFormatterRun : SourceExprCommand {
9
29
std::vector<std::string> args;
10
30
11
- CmdFmt () { expectArgs ({.label = " args" , .handler = {&args}}); }
31
+ CmdFormatterRun () { expectArgs ({.label = " args" , .handler = {&args}}); }
12
32
13
33
std::string description () override {
14
34
return " reformat your code in the standard style" ;
15
35
}
16
36
17
37
std::string doc () override {
18
38
return
19
- #include " fmt .md"
39
+ #include " formatter-run .md"
20
40
;
21
41
}
22
42
@@ -52,4 +72,14 @@ struct CmdFmt : SourceExprCommand {
52
72
};
53
73
};
54
74
55
- static auto r2 = registerCommand<CmdFmt>(" fmt" );
75
+ static auto rFormatterRun = registerCommand2<CmdFormatterRun>({" formatter" , " run" });
76
+
77
+ struct CmdFmt : CmdFormatterRun
78
+ {
79
+ void run (ref<Store> store) override
80
+ {
81
+ CmdFormatterRun::run (store);
82
+ }
83
+ };
84
+
85
+ static auto rFmt = registerCommand<CmdFmt>(" fmt" );
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ nix_sources = [config_priv_h] + files(
78
78
' env.cc' ,
79
79
' eval.cc' ,
80
80
' flake.cc' ,
81
- ' fmt .cc' ,
81
+ ' formatter .cc' ,
82
82
' hash.cc' ,
83
83
' log.cc' ,
84
84
' ls.cc' ,
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ suites = [
132
132
' nix-copy-ssh-ng.sh' ,
133
133
' post-hook.sh' ,
134
134
' function-trace.sh' ,
135
- ' fmt .sh' ,
135
+ ' formatter .sh' ,
136
136
' eval-store.sh' ,
137
137
' why-depends.sh' ,
138
138
' derivation-json.sh' ,
You can’t perform that action at this time.
0 commit comments