Skip to content

Commit c985dba

Browse files
authored
Limit --help and --help-hidden to 100 character line length (#58835)
Just fixing the command line description to make sure it is not more than 100 characters wide as discussed with @oscardssmith in PR #54066 and PR #53759. I also added a test to make sure that nothing more than 100 characters is inserted. Thank you.
1 parent 77b90b9 commit c985dba

File tree

2 files changed

+27
-20
lines changed

2 files changed

+27
-20
lines changed

src/jloptions.c

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ static const char opts[] =
179179
" Or, create a temporary environment with `@temp`\n"
180180
" The default @. option will search through parent\n"
181181
" directories until a Project.toml or JuliaProject.toml\n"
182-
" file is found. @script is similar, but searches up from\n"
183-
" the programfile or a path relative to programfile.\n"
182+
" file is found. @script is similar, but searches up\n"
183+
" from the programfile or a path relative to\n"
184+
" programfile.\n"
184185
" -J, --sysimage <file> Start up with the given system image file\n"
185186
" -H, --home <dir> Set location of `julia` executable\n"
186187
" --startup-file={yes*|no} Load `JULIA_DEPOT_PATH/config/startup.jl`; \n"
@@ -291,9 +292,9 @@ static const char opts[] =
291292
" information, see --bug-report=help.\n\n"
292293
" --heap-size-hint=<size>[<unit>] Forces garbage collection if memory usage is higher\n"
293294
" than the given value. The value may be specified as a\n"
294-
" number of bytes, optionally in units of: B, K (kibibytes),\n"
295-
" M (mebibytes), G (gibibytes), T (tebibytes), or % (percentage\n"
296-
" of physical memory).\n\n"
295+
" number of bytes, optionally in units of: B,\n"
296+
" K (kibibytes), M (mebibytes), G (gibibytes),\n"
297+
" T (tebibytes), or % (percentage of physical memory).\n\n"
297298
;
298299

299300
static const char opts_hidden[] =
@@ -319,24 +320,26 @@ static const char opts_hidden[] =
319320
" --output-asm <name> Generate an assembly file (.s)\n"
320321
" --output-incremental={yes|no*} Generate an incremental output file (rather than\n"
321322
" complete)\n"
322-
" --timeout-for-safepoint-straggler <seconds> If this value is set, then we will dump the backtrace for a thread\n"
323-
" that fails to reach a safepoint within the specified time\n"
323+
" --timeout-for-safepoint-straggler <seconds> If this value is set, then we will dump the backtrace\n"
324+
" for a thread that fails to reach a safepoint within\n"
325+
" the specified time\n"
324326
" --trace-compile={stderr|name} Print precompile statements for methods compiled\n"
325-
" during execution or save to stderr or a path. Methods that\n"
326-
" were recompiled are printed in yellow or with a trailing\n"
327-
" comment if color is not supported\n"
328-
" --trace-compile-timing If --trace-compile is enabled show how long each took to\n"
329-
" compile in ms\n"
327+
" during execution or save to stderr or a path. Methods\n"
328+
" that were recompiled are printed in yellow or with\n"
329+
" a trailing comment if color is not supported\n"
330+
" --trace-compile-timing If --trace-compile is enabled show how long each took\n"
331+
" to compile in ms\n"
330332
" --task-metrics={yes|no*} Enable collection of per-task timing data.\n"
331333
" --image-codegen Force generate code in imaging mode\n"
332-
" --permalloc-pkgimg={yes|no*} Copy the data section of package images into memory\n"
333-
" --trim={no*|safe|unsafe|unsafe-warn}\n"
334-
" Build a sysimage including only code provably reachable\n"
335-
" from methods marked by calling `entrypoint`. In unsafe\n"
336-
" mode, the resulting binary might be missing needed code\n"
337-
" and can throw errors. With unsafe-warn warnings will be\n"
338-
" printed for dynamic call sites that might lead to such\n"
339-
" errors. In safe mode compile-time errors are given instead.\n"
334+
" --permalloc-pkgimg={yes|no*} Copy the data section of package images into memory\n\n"
335+
336+
" --trim={no*|safe|unsafe|unsafe-warn} Build a sysimage including only code provably\n"
337+
" reachable from methods marked by calling\n"
338+
" `entrypoint`. In unsafe mode, the resulting binary\n"
339+
" might be missing needed code and can throw errors.\n"
340+
" With unsafe-warn warnings will be printed for\n"
341+
" dynamic call sites that might lead to such errors.\n"
342+
" In safe mode compile-time errors are given instead.\n"
340343
" --hard-heap-limit=<size>[<unit>] Set a hard limit on the heap size: if we ever\n"
341344
" go above this limit, we will abort. The value\n"
342345
" may be specified as a number of bytes,\n"

test/cmdlineargs.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
240240
@test startswith(read(`$exename --help`, String), header)
241241
end
242242

243+
# Test to make sure that command line --help and --help-hidden do not return a description which is more than 100 characters wide
244+
@test isempty(filter(x->length(x) > 100, readlines(`$exename -h`)))
245+
@test isempty(filter(x->length(x) > 100, readlines(`$exename --help-hidden`)))
246+
243247
# ~ expansion in --project and JULIA_PROJECT
244248
if !Sys.iswindows()
245249
let expanded = abspath(expanduser("~/foo/Project.toml"))

0 commit comments

Comments
 (0)