@@ -3,67 +3,23 @@ package mill.daemon
33import mainargs .{Flag , Leftover , arg }
44
55case class MillCliConfig (
6- @ deprecated(" No longer used" , " Mill 0.12.0" )
7- @ arg(
8- hidden = true ,
9- short = 'h' ,
10- doc =
11- """ (internal) The home directory where Mill looks for config and caches."""
12- )
13- home : os.Path = os.home,
14- // We need to keep it, otherwise, a given --repl would be silently parsed as target and result in misleading error messages.
15- // Instead, we fail programmatically when this flag is set.
16- @ deprecated(" No longer supported." , " Mill 0.11.0-M8" )
17- @ arg(
18- hidden = true ,
19- doc = """ This flag is no longer supported."""
20- )
21- repl : Flag = Flag (),
22- @ arg(
23- hidden = true ,
24- doc = """ Run without a background daemon. Must be the first argument."""
25- )
26- noServer : Flag = Flag (),
27- @ arg(
28- doc = """ Run without a background daemon. Must be the first argument."""
29- )
6+ // ==================== NORMAL CLI FLAGS ====================
7+ @ arg(doc = " Run without a long-lived background daemon. Must be the first argument." )
308 noDaemon : Flag = Flag (),
31- @ arg(doc = """ Enable BSP server mode.""" )
32- bsp : Flag ,
33- @ arg(doc = """ Create mill-bsp.json with Mill details under .bsp/""" )
34- bspInstall : Flag ,
35- @ arg(
36- doc =
37- """ Automatically reload the build when its sources change when running the BSP server (defaults to true)."""
38- )
39- bspWatch : Boolean = true ,
409 @ arg(name = " version" , short = 'v' , doc = " Show mill version information and exit." )
4110 showVersion : Flag = Flag (),
4211 @ arg(
4312 name = " bell" ,
4413 short = 'b' ,
45- doc = """ Ring the bell once if the run completes successfully, twice if it fails."" "
14+ doc = " Ring the bell once if the run completes successfully, twice if it fails."
4615 )
4716 ringBell : Flag = Flag (),
48- @ deprecated(" No longer supported, use `--ticker false`" , " Mill 0.12.0" )
49- @ arg(
50- hidden = true ,
51- doc =
52- """ Disable ticker log (e.g. short-lived prints of stages and progress bars)."""
53- )
54- disableTicker : Flag ,
5517 @ arg(
5618 doc =
57- """ Enable ticker log (e.g. short-lived prints of stages and progress bars)."""
19+ """ Enable or disable the ticker log, which provides information on running
20+ tasks and where each log line came from"""
5821 )
5922 ticker : Option [Boolean ] = None ,
60- @ deprecated(" No longer supported, use `--ticker false`" , " Mill 0.12.0" )
61- @ arg(
62- hidden = true ,
63- doc =
64- """ Enable ticker log (e.g. short-lived prints of stages and progress bars)."""
65- )
66- enableTicker : Option [Boolean ] = None ,
6723 @ arg(name = " debug" , short = 'd' , doc = " Show debug output on STDOUT" )
6824 debugLog : Flag = Flag (),
6925 @ arg(
@@ -97,61 +53,47 @@ case class MillCliConfig(
9753 short = 'i' ,
9854 doc =
9955 """ Run Mill in interactive mode, suitable for opening REPLs and taking user input.
100- This implies --no-server . Must be the first argument."""
56+ Identical to --no-daemon . Must be the first argument."""
10157 )
10258 interactive : Flag = Flag (),
10359 @ arg(doc = " Print this help message and exit." )
10460 help : Flag ,
105- @ arg(
106- short = 'w' ,
107- doc = """ Watch and re-run the given tasks when when their inputs change."""
108- )
61+ @ arg(doc = " Print a internal or advanced command flags not intended for common usage" )
62+ helpAdvanced : Flag ,
63+ @ arg(short = 'w' , doc = " Watch and re-run the given tasks when when their inputs change." )
10964 watch : Flag = Flag (),
11065 @ arg(
11166 name = " notify-watch" ,
11267 doc = " Use filesystem based file watching instead of polling based one (defaults to true)."
11368 )
11469 watchViaFsNotify : Boolean = true ,
115- @ arg(
116- short = 's' ,
117- doc =
118- """ Make ivy logs during script import resolution go silent instead of printing"""
119- )
120- silent : Flag = Flag (),
121- @ arg(
122- name = " task" ,
123- doc = """ The name or a pattern of the tasks(s) you want to build."""
124- )
70+ @ arg(name = " task" , doc = " The name or a query of the tasks(s) you want to build." )
12571 leftoverArgs : Leftover [String ] = Leftover (),
12672 @ arg(doc =
127- """ Toggle colored output; by default enabled only if the console is interactive and NO_COLOR environment variable is not set"""
73+ """ Toggle colored output; by default enabled only if the console is interactive
74+ and NO_COLOR environment variable is not set"""
12875 )
12976 color : Option [Boolean ] = None ,
130- @ arg(
131- name = " disable-callgraph" ,
132- doc = """
133- Disables fine-grained invalidation of tasks based on analyzing code changes. If passed, you
134- need to manually run `clean` yourself after build changes.
135- """
136- )
137- disableCallgraph : Flag = Flag (),
13877 @ arg(
13978 doc =
14079 """ Select a meta-level to run the given tasks. Level 0 is the main project in `build.mill`,
14180 level 1 the first meta-build in `mill-build/build.mill`, etc."""
14281 )
14382 metaLevel : Option [Int ] = None ,
83+
84+ // ==================== ADVANCED CLI FLAGS ====================
14485 @ arg(doc = " Allows command args to be passed positionally without `--arg` by default" )
14586 allowPositional : Flag = Flag (),
146- @ deprecated(" No longer used" , " Mill 0.13.0" )
87+ @ arg(hidden = true , doc = """ Enable BSP server mode.""" )
88+ bsp : Flag ,
89+ @ arg(hidden = true , doc = """ Create mill-bsp.json with Mill details under .bsp/""" )
90+ bspInstall : Flag ,
14791 @ arg(
148- doc = """
149- Disables the new multi-line status prompt used for showing thread
150- status at the command line and falls back to the legacy ticker
151- """ ,
152- hidden = true
92+ hidden = true ,
93+ doc =
94+ """ Automatically reload the build when its sources change when running the BSP server (defaults to true)."""
15395 )
154- disablePrompt : Flag = Flag () ,
96+ bspWatch : Boolean = true ,
15597 @ arg(
15698 hidden = true ,
15799 doc =
@@ -184,10 +126,28 @@ case class MillCliConfig(
184126 @ arg(
185127 doc = """ Runs Mill in tab-completion mode"""
186128 )
187- tabComplete : Flag = Flag ()
129+ tabComplete : Flag = Flag (),
130+
131+ // ==================== DEPRECATED CLI FLAGS ====================
132+ @ arg(hidden = true , short = 'h' , doc = " Unsupported" )
133+ home : os.Path = os.home,
134+ @ arg(hidden = true , doc = " Unsupported" )
135+ repl : Flag = Flag (),
136+ @ arg(hidden = true , doc = " Unsupported" )
137+ noServer : Flag = Flag (),
138+ @ arg(short = 's' , doc = " Unsupported" )
139+ silent : Flag = Flag (),
140+ @ arg(name = " disable-callgraph" , doc = " Unsupported" )
141+ disableCallgraph : Flag = Flag (),
142+ @ arg(hidden = true , doc = " Unsupported" )
143+ disablePrompt : Flag = Flag (),
144+ @ arg(hidden = true , doc = " Unsupported" )
145+ enableTicker : Option [Boolean ] = None ,
146+ @ arg(hidden = true , doc = " Unsupported" )
147+ disableTicker : Flag
188148) {
189149 def noDaemonEnabled =
190- Seq (interactive.value, noServer .value, noDaemon .value, bsp.value).count(identity)
150+ Seq (interactive.value, noDaemon .value, noServer .value, bsp.value).count(identity)
191151}
192152
193153import mainargs .ParserForClass
@@ -231,8 +191,21 @@ options:
231191
232192 import mill .define .JsonFormatters .*
233193
234- private lazy val parser : ParserForClass [MillCliConfig ] =
235- mainargs.ParserForClass [MillCliConfig ]
194+ private lazy val parser : ParserForClass [MillCliConfig ] = mainargs.ParserForClass [MillCliConfig ]
195+
196+ private lazy val helpAdvancedParser : ParserForClass [MillCliConfig ] = new ParserForClass (
197+ parser.main.copy(argSigs0 = parser.main.argSigs0.collect {
198+ case a if ! a.doc.contains(" Unsupported" ) && a.hidden =>
199+ a.copy(
200+ hidden = false ,
201+ // Hack to work around `a.copy` not propagating the name mapping correctly, so we have
202+ // to manually map the name ourselves. Doesn't affect runtime behavior since this is
203+ // just used for --help-advanced printing and not for argument parsing
204+ unMappedName = a.mappedName(mainargs.Util .kebabCaseNameMapper)
205+ )
206+ }),
207+ parser.companion
208+ )
236209
237210 lazy val shortUsageText : String =
238211 " Please specify a task to evaluate\n " +
@@ -244,7 +217,14 @@ options:
244217 customDoc +
245218 cheatSheet +
246219 parser.helpText(customName = " " , totalWidth = 100 ).stripPrefix(" \n " ) +
247- " \n Please see the documentation at https://mill-build.org for more details"
220+ " \n Please see the documentation at https://mill-build.org for more details,\n " +
221+ " or `./mill --help-advanced` for a list of advanced flags"
222+
223+ lazy val helpAdvancedUsageText : String =
224+ customName +
225+ customDoc +
226+ helpAdvancedParser.helpText(customName = " " , totalWidth = 100 ).stripPrefix(" \n " ) +
227+ " \n Advanced or internal command-line flags not intended for common usage. Use at your own risk!"
248228
249229 def parse (args : Array [String ]): mill.api.Result [MillCliConfig ] = {
250230 mill.api.Result .fromEither(parser.constructEither(
0 commit comments