Пример #1
0
        private static void Main(string[] args)
        {
            var app = new CommandLineApplication();

            app.HelpOption("-h|-?|--help");
            app.Command("send", SendCommand.Configure);
            app.Command("listen", ListenCommand.Configure);

            // Listen by default
            ListenCommand.Configure(app);

            app.Execute(args);
        }
Пример #2
0
        public static void Configure(CommandLineApplication app)
        {
            app.HelpOption("-h|-?|--help");

            var idOption = app.Option(
                "-n|--node",
                "The node ID",
                CommandOptionType.SingleValue);

            app.OnExecute(() =>
            {
                var id      = idOption.Value();
                var command = new ListenCommand(id);
                return(command.Execute());
            });
        }