40 lines
942 B
C#
40 lines
942 B
C#
using Titano.Tools;
|
|
using Titano.Tools.Commands;
|
|
|
|
var commands = new ICommand[]
|
|
{
|
|
new MakeIconCommand(),
|
|
new I18nCommand(),
|
|
new XamlLintCommand(),
|
|
new PackageGuardCommand(),
|
|
new ChangelogCommand(),
|
|
new PackInstallerCommand(),
|
|
new SelfTestCommand(),
|
|
new DiagnoseCommand(),
|
|
new FixturesCommand(),
|
|
};
|
|
|
|
if (args.Length == 0 || args[0] is "-h" or "--help" or "help")
|
|
{
|
|
Console.WriteLine("Titano.Tools <command> [options]");
|
|
foreach (var c in commands) Console.WriteLine($" {c.Name,-14} {c.Summary}");
|
|
return args.Length == 0 ? 2 : 0;
|
|
}
|
|
|
|
var command = commands.FirstOrDefault(c => c.Name.Equals(args[0], StringComparison.OrdinalIgnoreCase));
|
|
if (command is null)
|
|
{
|
|
Console.Error.WriteLine($"Unknown command '{args[0]}'. Run with --help.");
|
|
return 2;
|
|
}
|
|
|
|
try
|
|
{
|
|
return await command.RunAsync(args[1..]);
|
|
}
|
|
catch (ToolException ex)
|
|
{
|
|
Console.Error.WriteLine(ex.Message);
|
|
return 2;
|
|
}
|