File size: 27,521 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Management.Automation;
using System.Management.Automation.Internal;
using System.Management.Automation.Language;
using System.Management.Automation.Runspaces;
using System.Threading;
using Microsoft.Management.Infrastructure;
using Dbg = System.Management.Automation.Diagnostics;
//
// Now define the set of commands for manipulating modules.
//
namespace Microsoft.PowerShell.Commands
{
/// <summary>
/// Implements a cmdlet that gets the list of loaded modules...
/// </summary>
[Cmdlet(VerbsCommon.Get, "Module", DefaultParameterSetName = ParameterSet_Loaded,
HelpUri = "https://go.microsoft.com/fwlink/?LinkID=2096696")]
[OutputType(typeof(PSModuleInfo))]
public sealed class GetModuleCommand : ModuleCmdletBase, IDisposable
{
#region Cmdlet parameters
private const string ParameterSet_Loaded = "Loaded";
private const string ParameterSet_AvailableLocally = "Available";
private const string ParameterSet_AvailableInPsrpSession = "PsSession";
private const string ParameterSet_AvailableInCimSession = "CimSession";
/// <summary>
/// This parameter specifies the current pipeline object.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_Loaded, ValueFromPipeline = true, Position = 0)]
[Parameter(ParameterSetName = ParameterSet_AvailableLocally, ValueFromPipeline = true, Position = 0)]
[Parameter(ParameterSetName = ParameterSet_AvailableInPsrpSession, ValueFromPipeline = true, Position = 0)]
[Parameter(ParameterSetName = ParameterSet_AvailableInCimSession, ValueFromPipeline = true, Position = 0)]
[ValidateNotNullOrEmpty]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",
Justification = "Cmdlets use arrays for parameters.")]
public string[] Name { get; set; }
/// <summary>
/// This parameter specifies the current pipeline object.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_Loaded, ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = ParameterSet_AvailableLocally, ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = ParameterSet_AvailableInPsrpSession, ValueFromPipelineByPropertyName = true)]
[Parameter(ParameterSetName = ParameterSet_AvailableInCimSession, ValueFromPipelineByPropertyName = true)]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",
Justification = "Cmdlets use arrays for parameters.")]
public ModuleSpecification[] FullyQualifiedName { get; set; }
/// <summary>
/// If specified, all loaded modules should be returned, otherwise only the visible
/// modules should be returned.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_Loaded)]
[Parameter(ParameterSetName = ParameterSet_AvailableLocally)]
public SwitchParameter All { get; set; }
/// <summary>
/// If specified, then Get-Module will return the set of available modules...
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableLocally, Mandatory = true)]
[Parameter(ParameterSetName = ParameterSet_AvailableInPsrpSession)]
[Parameter(ParameterSetName = ParameterSet_AvailableInCimSession)]
public SwitchParameter ListAvailable { get; set; }
/// <summary>
/// If specified, then Get-Module will return the set of available modules which supports the specified PowerShell edition...
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableLocally)]
[Parameter(ParameterSetName = ParameterSet_AvailableInPsrpSession)]
[ArgumentCompleter(typeof(PSEditionArgumentCompleter))]
public string PSEdition { get; set; }
/// <summary>
/// When set, CompatiblePSEditions checking is disabled for modules in the System32 (Windows PowerShell) module directory.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableLocally)]
[Parameter(ParameterSetName = ParameterSet_AvailableInPsrpSession)]
[Parameter(ParameterSetName = ParameterSet_AvailableInCimSession)]
public SwitchParameter SkipEditionCheck
{
get { return (SwitchParameter)BaseSkipEditionCheck; }
set { BaseSkipEditionCheck = value; }
}
/// <summary>
/// If specified, then Get-Module refreshes the internal cmdlet analysis cache.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableLocally)]
[Parameter(ParameterSetName = ParameterSet_AvailableInPsrpSession)]
[Parameter(ParameterSetName = ParameterSet_AvailableInCimSession)]
public SwitchParameter Refresh { get; set; }
/// <summary>
/// If specified, then Get-Module will attempt to discover PowerShell modules on a remote computer using the specified session.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableInPsrpSession, Mandatory = true)]
[ValidateNotNull]
public PSSession PSSession { get; set; }
/// <summary>
/// If specified, then Get-Module will attempt to discover PS-CIM modules on a remote computer using the specified session.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableInCimSession, Mandatory = true)]
[ValidateNotNull]
public CimSession CimSession { get; set; }
/// <summary>
/// For interoperability with 3rd party CIM servers, user can specify custom resource URI.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableInCimSession, Mandatory = false)]
[ValidateNotNull]
public Uri CimResourceUri { get; set; }
/// <summary>
/// For interoperability with 3rd party CIM servers, user can specify custom namespace.
/// </summary>
[Parameter(ParameterSetName = ParameterSet_AvailableInCimSession, Mandatory = false)]
[ValidateNotNullOrEmpty]
public string CimNamespace { get; set; }
#endregion Cmdlet parameters
#region Remote discovery
private IEnumerable<PSModuleInfo> GetAvailableViaPsrpSessionCore(string[] moduleNames, Runspace remoteRunspace)
{
Dbg.Assert(remoteRunspace != null, "Caller should verify remoteRunspace != null");
using (var powerShell = System.Management.Automation.PowerShell.Create())
{
powerShell.Runspace = remoteRunspace;
powerShell.AddCommand("Get-Module");
powerShell.AddParameter("ListAvailable", true);
if (Refresh.IsPresent)
{
powerShell.AddParameter("Refresh", true);
}
if (moduleNames != null)
{
powerShell.AddParameter("Name", moduleNames);
}
string errorMessageTemplate = string.Format(
CultureInfo.InvariantCulture,
Modules.RemoteDiscoveryRemotePsrpCommandFailed,
"Get-Module");
foreach (
PSObject outputObject in
RemoteDiscoveryHelper.InvokePowerShell(powerShell, this, errorMessageTemplate,
this.CancellationToken))
{
PSModuleInfo moduleInfo = RemoteDiscoveryHelper.RehydratePSModuleInfo(outputObject);
yield return moduleInfo;
}
}
}
private static PSModuleInfo GetModuleInfoForRemoteModuleWithoutManifest(RemoteDiscoveryHelper.CimModule cimModule)
{
return new PSModuleInfo(cimModule.ModuleName, null, null);
}
private PSModuleInfo ConvertCimModuleInfoToPSModuleInfo(RemoteDiscoveryHelper.CimModule cimModule,
string computerName)
{
try
{
bool containedErrors = false;
if (cimModule.MainManifest == null)
{
return GetModuleInfoForRemoteModuleWithoutManifest(cimModule);
}
string temporaryModuleManifestPath = Path.Combine(
RemoteDiscoveryHelper.GetModulePath(cimModule.ModuleName, null, computerName,
this.Context.CurrentRunspace),
Path.GetFileName(cimModule.ModuleName));
Hashtable mainData = null;
if (!containedErrors)
{
mainData = RemoteDiscoveryHelper.ConvertCimModuleFileToManifestHashtable(
cimModule.MainManifest,
temporaryModuleManifestPath,
this,
ref containedErrors);
if (mainData == null)
{
return GetModuleInfoForRemoteModuleWithoutManifest(cimModule);
}
}
if (!containedErrors)
{
mainData = RemoteDiscoveryHelper.RewriteManifest(mainData);
}
Hashtable localizedData = mainData; // TODO/FIXME - this needs full path support from the provider
PSModuleInfo moduleInfo = null;
if (!containedErrors)
{
ImportModuleOptions throwAwayOptions = new ImportModuleOptions();
moduleInfo = LoadModuleManifest(
temporaryModuleManifestPath,
null, // scriptInfo
mainData,
localizedData,
0 /* - don't write errors, don't load elements, don't return null on first error */,
this.BaseMinimumVersion,
this.BaseMaximumVersion,
this.BaseRequiredVersion,
this.BaseGuid,
ref throwAwayOptions,
ref containedErrors);
}
if ((moduleInfo == null) || containedErrors)
{
moduleInfo = GetModuleInfoForRemoteModuleWithoutManifest(cimModule);
}
return moduleInfo;
}
catch (Exception e)
{
ErrorRecord errorRecord = RemoteDiscoveryHelper.GetErrorRecordForProcessingOfCimModule(e, cimModule.ModuleName);
this.WriteError(errorRecord);
return null;
}
}
private IEnumerable<PSModuleInfo> GetAvailableViaCimSessionCore(IEnumerable<string> moduleNames,
CimSession cimSession, Uri resourceUri,
string cimNamespace)
{
IEnumerable<RemoteDiscoveryHelper.CimModule> remoteModules = RemoteDiscoveryHelper.GetCimModules(
cimSession,
resourceUri,
cimNamespace,
moduleNames,
true /* onlyManifests */,
this,
this.CancellationToken);
IEnumerable<PSModuleInfo> remoteModuleInfos = remoteModules
.Select(cimModule => this.ConvertCimModuleInfoToPSModuleInfo(cimModule, cimSession.ComputerName))
.Where(static moduleInfo => moduleInfo != null);
return remoteModuleInfos;
}
#endregion Remote discovery
#region Cancellation support
private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
private CancellationToken CancellationToken
{
get { return _cancellationTokenSource.Token; }
}
/// <summary>
/// When overridden in the derived class, interrupts currently
/// running code within the command. It should interrupt BeginProcessing,
/// ProcessRecord, and EndProcessing.
/// Default implementation in the base class just returns.
/// </summary>
protected override void StopProcessing()
{
_cancellationTokenSource.Cancel();
}
#endregion
#region IDisposable Members
/// <summary>
/// Release all resources.
/// </summary>
public void Dispose()
{
if (_disposed)
{
return;
}
_cancellationTokenSource.Dispose();
_disposed = true;
}
private bool _disposed;
#endregion
private void AssertListAvailableMode()
{
if (!this.ListAvailable.IsPresent)
{
string errorMessage = Modules.RemoteDiscoveryWorksOnlyInListAvailableMode;
ArgumentException argumentException = new ArgumentException(errorMessage);
ErrorRecord errorRecord = new ErrorRecord(
argumentException,
"RemoteDiscoveryWorksOnlyInListAvailableMode",
ErrorCategory.InvalidArgument,
null);
this.ThrowTerminatingError(errorRecord);
}
}
/// <summary>
/// Write out the specified modules...
/// </summary>
protected override void ProcessRecord()
{
// Name and FullyQualifiedName should not be specified at the same time.
// Throw out terminating error if this is the case.
if ((Name != null) && (FullyQualifiedName != null))
{
string errMsg = StringUtil.Format(SessionStateStrings.GetContent_TailAndHeadCannotCoexist, "Name", "FullyQualifiedName");
ErrorRecord error = new ErrorRecord(new InvalidOperationException(errMsg), "NameAndFullyQualifiedNameCannotBeSpecifiedTogether", ErrorCategory.InvalidOperation, null);
ThrowTerminatingError(error);
}
// -SkipEditionCheck only makes sense for -ListAvailable (otherwise the module is already loaded)
if (SkipEditionCheck && !ListAvailable)
{
ErrorRecord error = new ErrorRecord(
new InvalidOperationException(Modules.SkipEditionCheckNotSupportedWithoutListAvailable),
nameof(Modules.SkipEditionCheckNotSupportedWithoutListAvailable),
ErrorCategory.InvalidOperation,
targetObject: null);
ThrowTerminatingError(error);
}
var strNames = new List<string>();
if (Name != null)
{
strNames.AddRange(Name);
}
var moduleSpecTable = new Dictionary<string, ModuleSpecification>(StringComparer.OrdinalIgnoreCase);
if (FullyQualifiedName != null)
{
for (int modSpecIndex = 0; modSpecIndex < FullyQualifiedName.Length; modSpecIndex++)
{
FullyQualifiedName[modSpecIndex] = FullyQualifiedName[modSpecIndex].WithNormalizedName(Context, SessionState.Path.CurrentLocation.Path);
}
moduleSpecTable = FullyQualifiedName.ToDictionary(static moduleSpecification => moduleSpecification.Name, StringComparer.OrdinalIgnoreCase);
strNames.AddRange(FullyQualifiedName.Select(static spec => spec.Name));
}
string[] names = strNames.Count > 0 ? strNames.ToArray() : null;
if (ParameterSetName.Equals(ParameterSet_Loaded, StringComparison.OrdinalIgnoreCase))
{
AssertNameDoesNotResolveToAPath(names,
Modules.ModuleDiscoveryForLoadedModulesWorksOnlyForUnQualifiedNames,
"ModuleDiscoveryForLoadedModulesWorksOnlyForUnQualifiedNames");
GetLoadedModules(names, moduleSpecTable, this.All);
}
else if (ParameterSetName.Equals(ParameterSet_AvailableLocally, StringComparison.OrdinalIgnoreCase))
{
if (ListAvailable.IsPresent)
{
GetAvailableLocallyModules(names, moduleSpecTable, this.All);
}
else
{
AssertNameDoesNotResolveToAPath(names,
Modules.ModuleDiscoveryForLoadedModulesWorksOnlyForUnQualifiedNames,
"ModuleDiscoveryForLoadedModulesWorksOnlyForUnQualifiedNames");
GetLoadedModules(names, moduleSpecTable, this.All);
}
}
else if (ParameterSetName.Equals(ParameterSet_AvailableInPsrpSession, StringComparison.OrdinalIgnoreCase))
{
AssertListAvailableMode();
AssertNameDoesNotResolveToAPath(names,
Modules.RemoteDiscoveryWorksOnlyForUnQualifiedNames,
"RemoteDiscoveryWorksOnlyForUnQualifiedNames");
GetAvailableViaPsrpSession(names, moduleSpecTable, this.PSSession);
}
else if (ParameterSetName.Equals(ParameterSet_AvailableInCimSession, StringComparison.OrdinalIgnoreCase))
{
AssertListAvailableMode();
AssertNameDoesNotResolveToAPath(names,
Modules.RemoteDiscoveryWorksOnlyForUnQualifiedNames,
"RemoteDiscoveryWorksOnlyForUnQualifiedNames");
GetAvailableViaCimSession(names, moduleSpecTable, this.CimSession,
this.CimResourceUri, this.CimNamespace);
}
else
{
Dbg.Assert(false, "Unrecognized parameter set");
}
}
private void AssertNameDoesNotResolveToAPath(string[] names, string stringFormat, string resourceId)
{
if (names != null)
{
foreach (var n in names)
{
if (n.Contains(StringLiterals.DefaultPathSeparator) || n.Contains(StringLiterals.AlternatePathSeparator))
{
string errorMessage = StringUtil.Format(stringFormat, n);
var argumentException = new ArgumentException(errorMessage);
var errorRecord = new ErrorRecord(
argumentException,
resourceId,
ErrorCategory.InvalidArgument,
n);
this.ThrowTerminatingError(errorRecord);
}
}
}
}
private void GetAvailableViaCimSession(IEnumerable<string> names, IDictionary<string, ModuleSpecification> moduleSpecTable,
CimSession cimSession, Uri resourceUri, string cimNamespace)
{
IEnumerable<PSModuleInfo> remoteModules = GetAvailableViaCimSessionCore(names, cimSession, resourceUri, cimNamespace);
foreach (PSModuleInfo remoteModule in FilterModulesForEditionAndSpecification(remoteModules, moduleSpecTable))
{
RemoteDiscoveryHelper.AssociatePSModuleInfoWithSession(remoteModule, cimSession, resourceUri,
cimNamespace);
this.WriteObject(remoteModule);
}
}
private void GetAvailableViaPsrpSession(string[] names, IDictionary<string, ModuleSpecification> moduleSpecTable, PSSession session)
{
IEnumerable<PSModuleInfo> remoteModules = GetAvailableViaPsrpSessionCore(names, session.Runspace);
foreach (PSModuleInfo remoteModule in FilterModulesForEditionAndSpecification(remoteModules, moduleSpecTable))
{
RemoteDiscoveryHelper.AssociatePSModuleInfoWithSession(remoteModule, session);
this.WriteObject(remoteModule);
}
}
private void GetAvailableLocallyModules(string[] names, IDictionary<string, ModuleSpecification> moduleSpecTable, bool all)
{
IEnumerable<PSModuleInfo> modules = GetModule(names, all, Refresh);
foreach (PSModuleInfo module in FilterModulesForEditionAndSpecification(modules, moduleSpecTable))
{
var psModule = new PSObject(module);
psModule.TypeNames.Insert(0, "ModuleInfoGrouping");
WriteObject(psModule);
}
}
private void GetLoadedModules(string[] names, IDictionary<string, ModuleSpecification> moduleSpecTable, bool all)
{
var modulesToWrite = Context.Modules.GetModules(names, all);
foreach (PSModuleInfo moduleInfo in FilterModulesForEditionAndSpecification(modulesToWrite, moduleSpecTable))
{
WriteObject(moduleInfo);
}
}
/// <summary>
/// Filter an enumeration of PowerShell modules based on the required PowerShell edition
/// and the module specification constraints set for each module (if any).
/// </summary>
/// <param name="modules">The modules to filter through.</param>
/// <param name="moduleSpecificationTable">Module constraints, keyed by module name, to filter modules of that name by.</param>
/// <returns>All modules from the original input that meet both any module edition and module specification constraints provided.</returns>
private IEnumerable<PSModuleInfo> FilterModulesForEditionAndSpecification(
IEnumerable<PSModuleInfo> modules,
IDictionary<string, ModuleSpecification> moduleSpecificationTable)
{
#if !UNIX
// Edition check only applies to Windows System32 module path
if (!SkipEditionCheck && ListAvailable && !All)
{
modules = modules.Where(static module => module.IsConsideredEditionCompatible);
}
#endif
if (!string.IsNullOrEmpty(PSEdition))
{
modules = modules.Where(module => module.CompatiblePSEditions.Contains(PSEdition, StringComparer.OrdinalIgnoreCase));
}
if (moduleSpecificationTable != null && moduleSpecificationTable.Count > 0)
{
modules = FilterModulesForSpecificationMatch(modules, moduleSpecificationTable);
}
return modules;
}
/// <summary>
/// Take an enumeration of modules and only return those that match a specification
/// in the given specification table, or have no corresponding entry in the specification table.
/// </summary>
/// <param name="modules">The modules to filter by specification match.</param>
/// <param name="moduleSpecificationTable">The specification lookup table to filter the modules on.</param>
/// <returns>The modules that match their corresponding table entry, or which have no table entry.</returns>
private static IEnumerable<PSModuleInfo> FilterModulesForSpecificationMatch(
IEnumerable<PSModuleInfo> modules,
IDictionary<string, ModuleSpecification> moduleSpecificationTable)
{
Dbg.Assert(moduleSpecificationTable != null, $"Caller to verify that {nameof(moduleSpecificationTable)} is not null");
Dbg.Assert(moduleSpecificationTable.Count != 0, $"Caller to verify that {nameof(moduleSpecificationTable)} is not empty");
foreach (PSModuleInfo module in modules)
{
IEnumerable<ModuleSpecification> candidateModuleSpecs = GetCandidateModuleSpecs(moduleSpecificationTable, module);
// Modules with table entries only get returned if they match them
// We skip the name check since modules have already been prefiltered base on the moduleSpec path/name
foreach (ModuleSpecification moduleSpec in candidateModuleSpecs)
{
if (ModuleIntrinsics.IsModuleMatchingModuleSpec(module, moduleSpec, skipNameCheck: true))
{
yield return module;
}
}
}
}
/// <summary>
/// Take a dictionary of module specifications and return those that potentially match the module
/// passed in as a parameter (checks on names and paths).
/// </summary>
/// <param name="moduleSpecTable">The module specifications to filter candidates from.</param>
/// <param name="module">The module to find candidates for from the module specification table.</param>
/// <returns>The module specifications matching the module based on name, path and subpath.</returns>
private static IEnumerable<ModuleSpecification> GetCandidateModuleSpecs(
IDictionary<string, ModuleSpecification> moduleSpecTable,
PSModuleInfo module)
{
const WildcardOptions options = WildcardOptions.IgnoreCase | WildcardOptions.CultureInvariant;
foreach (ModuleSpecification moduleSpec in moduleSpecTable.Values)
{
WildcardPattern namePattern = WildcardPattern.Get(moduleSpec.Name, options);
if (namePattern.IsMatch(module.Name) || moduleSpec.Name == module.Path || module.Path.Contains(moduleSpec.Name))
{
yield return moduleSpec;
}
}
}
}
/// <summary>
/// Provides argument completion for PSEdition parameter.
/// </summary>
public class PSEditionArgumentCompleter : IArgumentCompleter
{
/// <summary>
/// Returns completion results for PSEdition parameter.
/// </summary>
/// <param name="commandName">The command name.</param>
/// <param name="parameterName">The parameter name.</param>
/// <param name="wordToComplete">The word to complete.</param>
/// <param name="commandAst">The command AST.</param>
/// <param name="fakeBoundParameters">The fake bound parameters.</param>
/// <returns>List of completion results.</returns>
public IEnumerable<CompletionResult> CompleteArgument(
string commandName,
string parameterName,
string wordToComplete,
CommandAst commandAst,
IDictionary fakeBoundParameters)
=> CompletionHelpers.GetMatchingResults(wordToComplete, possibleCompletionValues: Utils.AllowedEditionValues);
}
}
|