diff --git a/Src/CommandLine/CommandInterface.cs b/Src/CommandLine/CommandInterface.cs index 232fad2..0adb7a3 100644 --- a/Src/CommandLine/CommandInterface.cs +++ b/Src/CommandLine/CommandInterface.cs @@ -28,6 +28,8 @@ private enum WatchLevelKind { Off, On, Prompt }; public const string ExitCommand = "exit"; public const string ExitShortCommand = "x"; + public const string NonInteractiveCommand = "noninteractive"; + private const string BusyMsg = "Busy; cancel or wait until operation completes"; private const string UnkCmdMsg = "Unknown command '{0}'"; private const string UnkSwitchMsg = "Unknown switch '{0}'"; @@ -373,9 +375,10 @@ public void Dispose() { } - internal bool DoOptions(out bool isExit) + internal bool DoOptions(out bool isExit, out bool isNonInteractive) { isExit = false; + isNonInteractive = false; if (!GetCommandLock()) { @@ -410,6 +413,11 @@ internal bool DoOptions(out bool isExit) isExit = true; break; } + else if (opt.Item1 == NonInteractiveCommand) + { + isNonInteractive = true; + break; + } else if (opt.Item2.Count == 0) { sink.WriteMessageLine(opt.Item1); diff --git a/Src/CommandLine/CommandLineProgram.cs b/Src/CommandLine/CommandLineProgram.cs index e42997a..2143935 100644 --- a/Src/CommandLine/CommandLineProgram.cs +++ b/Src/CommandLine/CommandLineProgram.cs @@ -21,8 +21,8 @@ public static void Main(string[] args) //// If errors occured while parsing switches //// then treat this an exit condition. - bool isExit; - ci.DoOptions(out isExit); + bool isExit, isNonInteractive; + ci.DoOptions(out isExit, out isNonInteractive); if (isExit || sink.PrintedError) { Environment.ExitCode = sink.PrintedError ? 1 : 0; @@ -30,7 +30,8 @@ public static void Main(string[] args) } if (OperatingSystem.IsMacOS() && - chooser.Interactive) + chooser.Interactive && + !isNonInteractive) { InteractivePrompt.Run(ci); Environment.ExitCode = sink.PrintedError ? 1 : 0;