Open LightSkif opened 5 years ago
Вместо выполнения команды выводиться help по команде. Команда запуска dotnet run -- anarchy -s 290 -h 50 -w 80
using Adeptik.CommandLineUtils.Engine; using Adeptik.CommandLineUtils.Attributes; using System; using Adeptik.CommandLineUtils.Exceptions; namespace ReportGenerator { class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); try { Command.Run(Root, args); } catch (CommandExecutionException e) { // Invalid command line arguments Console.WriteLine(e.Message); } catch (Exception e) { // Execution error Console.WriteLine(e.Message); } } // Корневая команда [Command] private static RootCommand Root() { return new RootCommand(); } // Контекст дочерних команд корневой команды private sealed class RootCommand { [Command(Description = "Connect to the Server")] public void anarchy( [CommandOption("s", Description = "scheme scale")] int? scale, [CommandOption("h", Description = "scheme height")] int? height, [CommandOption("w", Description = "scheme width")] int? width) { Console.WriteLine(scale); Console.WriteLine(height); Console.WriteLine(width); Console.ReadKey(); } } } } `
Опция не может иметь имя h или help, т.к. эти имена зарезервированы для опции вывода справки.
Вместо выполнения команды выводиться help по команде. Команда запуска dotnet run -- anarchy -s 290 -h 50 -w 80