Update files from psl-monad

This commit uses psl-monad branch source-depot cc6afbeb
And corresponds to [SD:692351]
This commit is contained in:
PowerShell Team authored and Sergei Vorobev committed 2016-03-31 17:27:44 -07:00
1 parent 111b254f3d
commit 5386c71bb2
32 files changed
+937 -248

No files matched your search

@@ -9,9 +9,11 @@ using System.Globalization;
using System.IO;
using System.Management.Automation;
using System.Management.Automation.Internal;
using System.Management.Automation.Language;
using System.Management.Automation.Runspaces;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading;
using Microsoft.Management.Infrastructure;
using Dbg = System.Management.Automation.Diagnostics;
@@ -80,7 +82,7 @@ namespace Microsoft.PowerShell.Commands
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableLocally)]
[Parameter(ParameterSetName = ParameterSet_AvailableInPsrpSession)]
[ValidateSet("Desktop", "Core")]
[ArgumentCompleter(typeof(PSEditionArgumentCompleter))]
public string PSEdition { get; set; }
/// <summary>
@@ -491,5 +493,28 @@ namespace Microsoft.PowerShell.Commands
}
}
}
/// <summary>
/// PSEditionArgumentCompleter for PowerShell Edition names.
/// </summary>
public class PSEditionArgumentCompleter : IArgumentCompleter
{
/// <summary>
/// CompleteArgument
/// </summary>
public IEnumerable<CompletionResult> CompleteArgument(string commandName, string parameterName, string wordToComplete, CommandAst commandAst, IDictionary fakeBoundParameters)
{
var wordToCompletePattern = WildcardPattern.Get(string.IsNullOrWhiteSpace(wordToComplete) ? "*" : wordToComplete + "*", WildcardOptions.IgnoreCase);
foreach (var edition in Utils.AllowedEditionValues)
{
if (wordToCompletePattern.IsMatch(edition))
{
yield return new CompletionResult(edition, edition, CompletionResultType.Text, edition);
}
}
}
}
} // Microsoft.PowerShell.Commands