Browse Source

Added /nointeractiveinput to usage screen

Source commit: c063200772439fce047fa9a3581db581d184533c
Martin Prikryl 5 years ago
parent
commit
ada8a09bf0

+ 1 - 0
source/resource/TextsWin.h

@@ -298,6 +298,7 @@
 #define PUTTY_SETTINGS_SITE_NAME 1588
 #define USAGE_USERNAME          1589
 #define USAGE_PASSWORD          1590
+#define USAGE_INTERACTIVEINPUT  1591
 
 #define WIN_FORMS_STRINGS       1600
 #define COPY_FILE               1605

+ 1 - 0
source/resource/TextsWin1.rc

@@ -303,6 +303,7 @@ BEGIN
         PUTTY_SETTINGS_SITE_NAME, "Terminal settings for %s"
         USAGE_USERNAME, "An alternative way to provide a username"
         USAGE_PASSWORD, "An alternative way to provide a password"
+        USAGE_INTERACTIVEINPUT, "All prompts are automatically cancelled"
 
         WIN_FORMS_STRINGS, "WIN_FORMS_STRINGS"
         COPY_FILE, "%s file '%s' to %s:"

+ 14 - 2
source/windows/ConsoleRunner.cpp

@@ -2208,7 +2208,14 @@ void __fastcall Usage(TConsole * Console)
     FORMAT(L"[/script=<file>] [/%s cmd1...] [/parameter // param1...]", (LowerCase(COMMAND_SWITCH))));
   PrintUsageSyntax(Console,
     FORMAT(L"[/%s=<logfile> [/loglevel=<level>]] [/%s=[<count>%s]<size>]", (LowerCase(LOG_SWITCH), LowerCase(LOGSIZE_SWITCH), LOGSIZE_SEPARATOR)));
-  PrintUsageSyntax(Console, L"[/xmllog=<logfile> [/xmlgroups]]");
+  if (!Console->CommandLineOnly())
+  {
+    PrintUsageSyntax(Console, L"[/xmllog=<logfile> [/xmlgroups]]");
+  }
+  else
+  {
+    PrintUsageSyntax(Console, FORMAT(L"[/xmllog=<logfile> [/xmlgroups]] [/%s]", (LowerCase(NOINTERACTIVEINPUT_SWITCH))));
+  }
   PrintUsageSyntax(Console,
     FORMAT(L"[/%s=<inifile>]", (LowerCase(INI_SWITCH))));
   PrintUsageSyntax(Console, FORMAT(L"[/%s config1=value1 config2=value2 ...]", (LowerCase(RAW_CONFIG_SWITCH))));
@@ -2259,6 +2266,10 @@ void __fastcall Usage(TConsole * Console)
   RegisterSwitch(SwitchesUsage, TProgramParams::FormatSwitch(LOGSIZE_SWITCH) + L"=", USAGE_LOGSIZE);
   RegisterSwitch(SwitchesUsage, L"/xmllog=", USAGE_XMLLOG);
   RegisterSwitch(SwitchesUsage, L"/xmlgroups", USAGE_XMLGROUPS);
+  if (Console->CommandLineOnly())
+  {
+    RegisterSwitch(SwitchesUsage, TProgramParams::FormatSwitch(NOINTERACTIVEINPUT_SWITCH), USAGE_INTERACTIVEINPUT);
+  }
   RegisterSwitch(SwitchesUsage, TProgramParams::FormatSwitch(INI_SWITCH) + L"=", USAGE_INI);
   RegisterSwitch(SwitchesUsage, TProgramParams::FormatSwitch(RAW_CONFIG_SWITCH), USAGE_RAWCONFIG);
   RegisterSwitch(SwitchesUsage, TProgramParams::FormatSwitch(RAWTRANSFERSETTINGS_SWITCH), USAGE_RAWTRANSFERSETTINGS);
@@ -2710,7 +2721,8 @@ int __fastcall Console(TConsoleMode Mode)
     if (Params->FindSwitch(L"consoleinstance", ConsoleInstance))
     {
       Configuration->Usage->Inc(L"ConsoleExternal");
-      Console = new TExternalConsole(ConsoleInstance, Params->FindSwitch(L"nointeractiveinput"));
+      bool NoInteractiveInput = Params->FindSwitch(NOINTERACTIVEINPUT_SWITCH);
+      Console = new TExternalConsole(ConsoleInstance, NoInteractiveInput);
     }
     else if (Params->FindSwitch(L"Console") || (Mode != cmScripting))
     {

+ 1 - 1
source/windows/UserInterface.cpp

@@ -193,7 +193,7 @@ void __fastcall ShowExtendedExceptionEx(TTerminal * Terminal,
     // (which always uses /nointeractiveinput),
     // but can be useful for other console runs too
     TProgramParams * Params = TProgramParams::Instance();
-    if (Params->FindSwitch(L"nointeractiveinput"))
+    if (Params->FindSwitch(NOINTERACTIVEINPUT_SWITCH))
     {
       DoNotDisplay = true;
       if (Show && CheckXmlLogParam(Params))

+ 1 - 0
source/windows/WinInterface.h

@@ -49,6 +49,7 @@ const int mpAllowContinueOnError = 0x02;
 #define INFO_SWITCH L"Info"
 #define COMREGISTRATION_SWITCH L"ComRegistration"
 #define BROWSE_SWITCH L"Browse"
+#define NOINTERACTIVEINPUT_SWITCH L"NoInteractiveInput"
 
 #define DUMPCALLSTACK_EVENT L"WinSCPCallstack%d"