示例#1
0
        public BindContext Bind(IConsole console, string[] args)
        {
            EnsureInitialized();
            App.SetConsole(console);
            App.Execute(args);

            if (App.SelectedCommand != null)
            {
                // execution normally stops when help --help or --version is hit
                App.SelectedCommand.Invoke();
            }

            return((BindContext)App.State);
        }
        public BindResult Bind(IConsole console, string[] args)
        {
            EnsureInitialized();
            App.SetConsole(console);

            var processor = new CommandLineProcessor(App, args);
            var command   = processor.Process();

            var validationResult = command.GetValidationResult();

            command.Invoke();

            _bindResult.Command          = command;
            _bindResult.ValidationResult = validationResult;
            _bindResult.ParentTarget     = _target;
            return(_bindResult);
        }