Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doc] fix #7562 by making --helpFull combine --help + old --advanced for easier grepping in a single cmd; add --deprecatedCommands #7621

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const
const
Usage = slurp"../doc/basicopt.txt".replace("//", "")
AdvancedUsage = slurp"../doc/advopt.txt".replace("//", "")
DeprecatedUsage = slurp"../doc/deprecatedopt.txt".replace("//", "")

proc getCommandLineDesc(): string =
result = (HelpMessage % [VersionAsString, platform.OS[platform.hostOS].name,
Expand All @@ -69,14 +70,19 @@ proc helpOnError(pass: TCmdLinePass) =
msgWriteln(getCommandLineDesc(), {msgStdout})
msgQuit(0)

proc writeAdvancedUsage(pass: TCmdLinePass) =
proc writeHelpFull(pass: TCmdLinePass) =
if pass == passCmd1:
msgWriteln(`%`(HelpMessage, [VersionAsString,
platform.OS[platform.hostOS].name,
CPU[platform.hostCPU].name]) & AdvancedUsage,
CPU[platform.hostCPU].name]) & Usage & AdvancedUsage,
{msgStdout})
msgQuit(0)

proc writeDeprecatedCommands(pass: TCmdLinePass) =
if pass == passCmd1:
msgWriteln(DeprecatedUsage, {msgStdout})
msgQuit(0)

proc writeVersionInfo(pass: TCmdLinePass) =
if pass == passCmd1:
msgWriteln(`%`(HelpMessage, [VersionAsString,
Expand Down Expand Up @@ -608,9 +614,12 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
of "version", "v":
expectNoArg(switch, arg, pass, info)
writeVersionInfo(pass)
of "advanced":
of "helpfull", "advanced":
expectNoArg(switch, arg, pass, info)
writeHelpFull(pass)
of "deprecatedcommands":
expectNoArg(switch, arg, pass, info)
writeAdvancedUsage(pass)
writeDeprecatedCommands(pass)
of "help", "h":
expectNoArg(switch, arg, pass, info)
helpOnError(pass)
Expand Down
2 changes: 1 addition & 1 deletion compiler/msgs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ proc quit(msg: TMsgKind) =
writeStackTrace()
else:
styledMsgWriteln(fgRed, "No stack traceback available\n" &
"To create a stacktrace, rerun compilation with ./koch temp " &
"To create a stacktrace, rerun compilation without `-d:release`, eg: ./koch temp " &
options.command & " <file>")
quit 1

Expand Down
1 change: 1 addition & 0 deletions doc/advopt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ Advanced options:
value = number of processors (0 for auto-detect)
--verbosity:0|1|2|3 set Nim's verbosity level (1 is default)
--experimental enable experimental language features
--deprecatedCommands show deprecated command line switches (incomplete)
-v, --version show detailed version information
2 changes: 1 addition & 1 deletion doc/basicopt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Options:
--app:console|gui|lib|staticlib
generate a console app|GUI app|DLL|static library
-r, --run run the compiled program with given arguments
--advanced show advanced command line switches
--helpFull show full command line switches
-h, --help show this help

Note, single letter options that take an argument require a colon. E.g. -p:PATH.
4 changes: 4 additions & 0 deletions doc/deprecatedopt.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deprecated command line switches

advanced => helpFull
babelpath => nimblePath