Beispiel #1
0
        public KeyHandler(IConsole console,
                          IConsoleWriter writer,
                          IPromptProvider promptProvider,
                          IHistoryNavigator historyNavigator,
                          ICompletionNavigator completionNavigator,
                          ICompletionWriter completionWriter)
        {
            _console             = console;
            _writer              = writer;
            _promptProvider      = promptProvider;
            _historyNavigator    = historyNavigator;
            _completionNavigator = completionNavigator;
            _completionWriter    = completionWriter;
            AddHandler(_writer.MoveCursorLeft, Seqs.ControlB, Seqs.LeftArrow);
            AddHandler(_writer.MoveCursorRight, Seqs.ControlF, Seqs.RightArrow);

            AddHandler(_writer.MoveCursorHome, Seqs.ControlA, Seqs.Home);

            AddHandler(_writer.MoveCursorEnd, Seqs.ControlE, Seqs.End);

            AddHandler(Backspace, Seqs.ControlH, Seqs.Backspace);

            AddHandler(ClearScreen, Seqs.ControlL);

            AddHandler(PreviousHistory, Seqs.ControlP, Seqs.UpArrow);
            AddHandler(NextHistory, Seqs.ControlN, Seqs.DownArrow);

            AddHandler(BreakProcess, Seqs.ControlC);

            AddHandler(NextAutoComplete, Seqs.Tab);
            AddHandler(PrevAutoComplete, Seqs.ShiftTab);

            // Cmder specific features
            //AddHandler(TraverseUpDirectory, Seqs.ControlAltU);

            // Gnu Readline https://en.wikipedia.org/wiki/GNU_Readline
            //AddHandler(DeleteNextChar, Seqs.ControlD);

            //AddHandler(SearchHistoryUp, Seqs.ControlR);
            //AddHandler(SearchHistoryDown, Seqs.ControlS);

            // Undo
            //AddHandler(Undo, Seqs.ControlUnderscore, Seqs.ControlXControlU);
            //_handlers.Add(BuildKey(ConsoleKey.Underscore, Console.Control), Undo);
        }
Beispiel #2
0
 public AccumulatingBlockDataFlowCommand(
     IOptions <ProgramOptions> optionsAccessor,
     IReader <TSource> reader,
     Func <IProcessor <TSource, TTarget> > processor,
     Func <IWriter <TTarget> > writer,
     ILogger <AccumulatingBlockDataFlowCommand <TSource, TTarget> > logger,
     ICompletionWriter <TTarget> completionWriter = null,
     Func <IAccumulatingBufferBlock <TTarget> > accumulatingBlock = null
     )
 {
     Options           = optionsAccessor?.Value;
     Reader            = reader;
     Processor         = processor;
     Writer            = writer;
     Logger            = logger;
     CompletionWriter  = completionWriter;
     AccumulatingBlock = accumulatingBlock;
 }