예제 #1
0
        public async Task PwshCompletionInstaller_ShouldUseCorrectNewlinesForPlatform()
        {
            var pwshInstaller = new PwshCompletionInstaller(commandOutputProvider, fileSystem);
            await installAutoCompleteCommand.Execute(new[] { $"--shell={pwshInstaller.SupportedShell.ToString()}", "--dryRun" });

            if (ExecutionEnvironment.IsRunningOnWindows)
            {
                commandOutputProvider.Received().Information(Arg.Is <string>(arg => arg.Contains(pwshInstaller.ProfileScript.NormalizeNewLinesForWindows())));
            }

            if (ExecutionEnvironment.IsRunningOnMac || ExecutionEnvironment.IsRunningOnNix)
            {
                commandOutputProvider.Received().Information(Arg.Is <string>(arg => arg.Contains(pwshInstaller.ProfileScript.NormalizeNewLinesForNix())));
            }
        }
예제 #2
0
        static IEnumerable <ShellCompletionInstaller> GetShellCompletionInstallers()
        {
            var zshCompletionInstaller        = new ZshCompletionInstaller(commandOutputProvider, fileSystem);
            var pwshCompletionInstaller       = new PwshCompletionInstaller(commandOutputProvider, fileSystem);
            var bashCompletionInstaller       = new BashCompletionInstaller(commandOutputProvider, fileSystem);
            var powershellCompletionInstaller = new PowershellCompletionInstaller(commandOutputProvider, fileSystem);

            var installers = new List <ShellCompletionInstaller>
            {
                zshCompletionInstaller, bashCompletionInstaller, pwshCompletionInstaller
            };

            if (ExecutionEnvironment.IsRunningOnWindows)
            {
                installers.Add(powershellCompletionInstaller);
            }

            return(installers);
        }