Return specific error codes from command execution.

This commit is contained in:
2019-01-05 19:50:56 +00:00
parent 104bc55c5e
commit 372f9f68ac
28 changed files with 351 additions and 204 deletions

View File

@@ -32,6 +32,7 @@
using System.Collections.Generic;
using System.Linq;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.Console;
using DiscImageChef.Core;
using DiscImageChef.Devices;
@@ -64,7 +65,7 @@ namespace DiscImageChef.Commands
if(showHelp)
{
Options.WriteOptionDescriptions(CommandSet.Out);
return 0;
return (int)ErrorNumber.HelpRequested;
}
MainClass.PrintCopyright();
@@ -74,7 +75,7 @@ namespace DiscImageChef.Commands
if(extra.Count > 0)
{
DicConsole.ErrorWriteLine("Too many arguments.");
return 1;
return (int)ErrorNumber.UnexpectedArgumentCount;
}
DicConsole.DebugWriteLine("List-Devices command", "--debug={0}", MainClass.Debug);
@@ -98,7 +99,7 @@ namespace DiscImageChef.Commands
}
Statistics.AddCommand("list-devices");
return 0;
return (int)ErrorNumber.NoError;
}
}
}