mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
hactoolnet: Set a different exit code on error
This commit is contained in:
parent
7904772fc0
commit
f85eff4ab7
1 changed files with 9 additions and 5 deletions
|
@ -7,11 +7,11 @@ namespace hactoolnet
|
||||||
{
|
{
|
||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Run(args);
|
if (Run(args)) return 0;
|
||||||
}
|
}
|
||||||
catch (MissingKeyException ex)
|
catch (MissingKeyException ex)
|
||||||
{
|
{
|
||||||
|
@ -26,14 +26,16 @@ namespace hactoolnet
|
||||||
Console.WriteLine(ex.GetType().FullName);
|
Console.WriteLine(ex.GetType().FullName);
|
||||||
Console.WriteLine(ex.StackTrace);
|
Console.WriteLine(ex.StackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Run(string[] args)
|
private static bool Run(string[] args)
|
||||||
{
|
{
|
||||||
Console.OutputEncoding = Encoding.UTF8;
|
Console.OutputEncoding = Encoding.UTF8;
|
||||||
var ctx = new Context();
|
var ctx = new Context();
|
||||||
ctx.Options = CliParser.Parse(args);
|
ctx.Options = CliParser.Parse(args);
|
||||||
if (ctx.Options == null) return;
|
if (ctx.Options == null) return false;
|
||||||
|
|
||||||
using (var logger = new ProgressBar())
|
using (var logger = new ProgressBar())
|
||||||
{
|
{
|
||||||
|
@ -43,11 +45,13 @@ namespace hactoolnet
|
||||||
if (ctx.Options.RunCustom)
|
if (ctx.Options.RunCustom)
|
||||||
{
|
{
|
||||||
CustomTask(ctx);
|
CustomTask(ctx);
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RunTask(ctx);
|
RunTask(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RunTask(Context ctx)
|
private static void RunTask(Context ctx)
|
||||||
|
|
Loading…
Reference in a new issue