[SabreTools] Add --script flag

This commit is contained in:
Matt Nadareski
2017-01-21 13:49:07 -08:00
parent 099e59a049
commit e0c2693822
3 changed files with 13 additions and 2 deletions

View File

@@ -146,6 +146,7 @@ namespace SabreTools.Helper.Data
helptext.Add("");
helptext.Add("Options:");
helptext.Add(" -?, -h, --help Show this help");
helptext.Add(" --script Enable script mode (no clear screen)");
// DATFromDir
helptext.Add(" -d, --dfd Create a DAT from an input directory");

View File

@@ -140,6 +140,12 @@ Options:
-?, -h, --help Show the built-in help text
Built-in to most of the programs is a basic help text
--script Enable script mode (no clear screen)
For times when SabreTools is being used in a scripted environement, the user may
not want the screen to be cleared every time that it is called. This flag allows
the user to skip clearing the screen on run just like if the console was being
redirected.
-d, --dfd Create a DAT from each input directory
Create a DAT file from an input directory or set of files. By default, this will
output a DAT named based on the input directory and the current date. It will also

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using SabreTools.Helper;
using SabreTools.Helper.Data;
@@ -29,8 +30,8 @@ namespace SabreTools
// Perform initial setup and verification
_logger = new Logger(true, "sabretools.log");
// If output is being redirected, don't allow clear screens
if (!Console.IsOutputRedirected)
// If output is being redirected or we are in script mode, don't allow clear screens
if (!Console.IsOutputRedirected && !args.Contains("--script"))
{
Console.Clear();
}
@@ -197,6 +198,9 @@ namespace SabreTools
case "--restore":
restore = true;
break;
case "--script":
// No-op for script mode, allowing for retaining the screen
break;
case "-ss":
case "--sort":
sort = true;