Example #1
0
        protected IDisposable UseRequestedDispatchTables()
        {
            bool inViMode           = PSConsoleReadLine.GetOptions().EditMode == EditMode.Vi;
            bool viModeParamPresent = MyInvocation.BoundParameters.ContainsKey("ViMode");

            if (inViMode || viModeParamPresent)
            {
                if (!inViMode)
                {
                    // "-ViMode" must have been specified explicitly. Well, okay... we can
                    // modify the Vi tables... but isn't that an odd thing to do from
                    // not-vi mode?
                    WriteWarning(PSReadLineResources.NotInViMode);
                }

                if (ViMode == ViMode.Command)
                {
                    return(PSConsoleReadLine.UseViCommandModeTables());
                }
                else // default if -ViMode not specified, invalid, or "Insert"
                {
                    return(PSConsoleReadLine.UseViInsertModeTables());
                }
            }

            return(null);
        }
Example #2
0
 protected override void EndProcessing()
 {
     WriteObject(PSConsoleReadLine.GetOptions());
 }