mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Return specific error codes from command execution.
This commit is contained in:
@@ -71,7 +71,7 @@ namespace DiscImageChef.Commands
|
||||
if(showHelp)
|
||||
{
|
||||
Options.WriteOptionDescriptions(CommandSet.Out);
|
||||
return 0;
|
||||
return (int)ErrorNumber.HelpRequested;
|
||||
}
|
||||
|
||||
MainClass.PrintCopyright();
|
||||
@@ -81,13 +81,13 @@ namespace DiscImageChef.Commands
|
||||
if(extra.Count > 1)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Too many arguments.");
|
||||
return 1;
|
||||
return (int)ErrorNumber.UnexpectedArgumentCount;
|
||||
}
|
||||
|
||||
if(extra.Count == 0)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Missing device path.");
|
||||
return 1;
|
||||
return (int)ErrorNumber.MissingArgument;
|
||||
}
|
||||
|
||||
devicePath = extra[0];
|
||||
@@ -106,7 +106,7 @@ namespace DiscImageChef.Commands
|
||||
if(dev.Error)
|
||||
{
|
||||
DicConsole.ErrorWriteLine("Error {0} opening device.", dev.LastError);
|
||||
return 1;
|
||||
return (int)ErrorNumber.CannotOpenDevice;
|
||||
}
|
||||
|
||||
Statistics.AddDevice(dev);
|
||||
@@ -161,7 +161,7 @@ namespace DiscImageChef.Commands
|
||||
Statistics.AddCommand("media-scan");
|
||||
|
||||
dev.Close();
|
||||
return 0;
|
||||
return (int)ErrorNumber.NoError;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user