Skip to content

Commit 9f391c2

Browse files
committed
Updating the help message. Also enable -h and -help as per request in #2472.
Enables `-h` and `-help` for non-release builds, and `-?`, `-h`, and `-help` for release builds. Messages will look as follows. debug/test builds: ``` Usage: ch.exe [-v|-version] [-h|-help] [-?] [flaglist] <source file> -v|-version Displays version info -h|-help Displays this help message -? Displays this help message with complete [flaglist] info ``` release builds: ``` Usage: ch.exe [-v|-version] [-h|-help|-?] <source file> Note: [flaglist] is not supported in Release builds; try a Debug or Test build to enable these flags. -v|-version Displays version info -h|-help|-? Displays this help message ``` The distinction is that `-?` is already implemented in debug/test builds to display full information about the `[flaglist]` options. This is a minimal change here that will result in guiding the user more accurately in all build flavors, the effect of which is that `-?` in debug/test builds is still the only way to get information about the `[flaglist]` options.
1 parent 10f53b4 commit 9f391c2

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

bin/ch/HostConfigFlags.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void HostConfigFlags::PrintUsage()
7878
pfnPrintUsage();
7979
}
8080

81-
wprintf(_u("\nFlag List : \n"));
81+
wprintf(_u("\nHost Config Flags: \n\n"));
8282
HostConfigFlags::PrintUsageString();
8383
ChakraRTInterface::PrintConfigFlagsUsageString();
8484
}

bin/ch/ch.cpp

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,28 @@ int HostExceptionFilter(int exceptionCode, _EXCEPTION_POINTERS *ep)
6565

6666
void __stdcall PrintUsageFormat()
6767
{
68-
wprintf(_u("\nUsage: %s [flaglist] <source file>\n"), hostName);
68+
wprintf(_u("\nUsage: %s [-v|-version] [-h|-help] [-?] [flaglist] <source file>\n"), hostName);
69+
wprintf(_u("\t-v|-version\t\tDisplays version info\n"));
70+
wprintf(_u("\t-h|-help\t\tDisplays this help message\n"));
71+
wprintf(_u("\t-?\t\t\tDisplays this help message with complete [flaglist] info\n"));
6972
}
7073

74+
#if !defined(ENABLE_DEBUG_CONFIG_OPTIONS)
75+
void __stdcall PrintReleaseUsage()
76+
{
77+
wprintf(_u("\nUsage: %s [-v|-version] [-h|-help|-?] <source file> %s"), hostName,
78+
_u("\nNote: [flaglist] is not supported in Release builds; try a Debug or Test build to enable these flags.\n"));
79+
wprintf(_u("\t-v|-version\t\tDisplays version info\n"));
80+
wprintf(_u("\t-h|-help|-?\t\tDisplays this help message\n"));
81+
}
82+
#endif
83+
7184
void __stdcall PrintUsage()
7285
{
7386
#if !defined(ENABLE_DEBUG_CONFIG_OPTIONS)
74-
wprintf(_u("\nUsage: %s <source file> %s"), hostName,
75-
_u("\n[flaglist] is not supported for Release mode\n"));
87+
PrintReleaseUsage();
7688
#else
7789
PrintUsageFormat();
78-
wprintf(_u("Try '%s -?' for help\n"), hostName);
7990
#endif
8091
}
8192

@@ -805,6 +816,18 @@ int _cdecl wmain(int argc, __in_ecount(argc) LPWSTR argv[])
805816
PAL_Shutdown();
806817
return EXIT_SUCCESS;
807818
}
819+
else if (
820+
#if !defined(ENABLE_DEBUG_CONFIG_OPTIONS) // release builds can display some kind of help message
821+
(arglen == 1 && wcsncmp(arg, _u("?"), arglen) == 0) ||
822+
#endif
823+
(arglen == 1 && wcsncmp(arg, _u("h"), arglen) == 0) ||
824+
(arglen == 4 && wcsncmp(arg, _u("help"), arglen) == 0)
825+
)
826+
{
827+
PrintUsage();
828+
PAL_Shutdown();
829+
return EXIT_SUCCESS;
830+
}
808831
else if(wcsstr(argv[i], _u("-TTRecord=")) == argv[i])
809832
{
810833
doTTRecord = true;

0 commit comments

Comments
 (0)