Exemplo n.º 1
0
        /// <summary>
        /// Initializes an instance of <see cref="CliApplication"/>.
        /// </summary>
        public CliApplication(IServiceProvider serviceProvider,
                              CliContext cliContext)
        {
            ServiceScopeFactory = serviceProvider.GetService <IServiceScopeFactory>();

            CliContext = cliContext;

            _metadata      = cliContext.Metadata;
            _configuration = cliContext.Configuration;
            _console       = cliContext.Console;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes an instance of <see cref="InteractiveCliApplication"/>.
        /// </summary>
        public InteractiveCliApplication(IServiceProvider serviceProvider,
                                         CliContext cliContext,
                                         ConsoleColor promptForeground,
                                         ConsoleColor commandForeground,
                                         HashSet <ShortcutDefinition> userDefinedShortcut) :
            base(serviceProvider, cliContext)
        {
            _promptForeground  = promptForeground;
            _commandForeground = commandForeground;

            if (cliContext.Configuration.IsAdvancedInputAllowed)
            {
                _autoCompleteInput = new AutoCompleteInput(cliContext.Console, userDefinedShortcut)
                {
                    AutoCompletionHandler = new AutoCompletionHandler(cliContext),
                };

                _autoCompleteInput.History.IsEnabled = true;
                cliContext.InputHistory = _autoCompleteInput.History;
            }
        }