Skip to content

Commit ab8dd45

Browse files
author
Kapil Borle
committed
Add documentation for module manifest helper methods
1 parent 4f3e19f commit ab8dd45

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Engine/Helper.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,6 +1602,11 @@ public bool GetNamedArgumentAttributeValue(NamedAttributeArgumentAst namedAttrib
16021602
return false;
16031603
}
16041604

1605+
/// <summary>
1606+
/// Gets valid keys of a PowerShell module manifest file for a given PowerShell version
1607+
/// </summary>
1608+
/// <param name="powershellVersion">Version parameter with valid values: 5.0, 4.0 and 3.0</param>
1609+
/// <returns>Returns an enumerator over valid keys</returns>
16051610
public static IEnumerable<string> GetModuleManifestKeys(Version powershellVersion)
16061611
{
16071612
if (powershellVersion == null)
@@ -1651,18 +1656,33 @@ public static IEnumerable<string> GetModuleManifestKeys(Version powershellVersio
16511656
return keys;
16521657
}
16531658

1659+
/// <summary>
1660+
/// Gets deprecated keys of PowerShell module manifest
1661+
/// </summary>
1662+
/// <returns>Returns an enumerator over deprecated keys</returns>
16541663
public static IEnumerable<string> GetDeprecatedModuleManifestKeys()
16551664
{
16561665
return new List<string> { "ModuleToProcess" };
16571666
}
16581667

1668+
/// <summary>
1669+
/// Checks if a given file is a valid PowerShell module manifest
1670+
/// </summary>
1671+
/// <param name="filepath">Path to module manifest</param>
1672+
/// <returns>true if given filepath points to a module manifest, otherwise false</returns>
16591673
public static bool IsModuleManifest(string filepath)
16601674
{
16611675
// 4.0 and 3.0 contain the same keys. Hence, compare only with 4.0.
16621676
return IsModuleManifest(filepath, new Version("5.0"))
16631677
|| IsModuleManifest(filepath, new Version("4.0"));
16641678
}
16651679

1680+
/// <summary>
1681+
/// Checks if a given file is a valid PowerShell module manifest
1682+
/// </summary>
1683+
/// <param name="filepath">Path to module manifest</param>
1684+
/// <param name="powershellVersion">Version parameter with valid values: 5.0, 4.0 and 3.0</param>
1685+
/// <returns>true if given filepath points to a module manifest, otherwise false</returns>
16661686
public static bool IsModuleManifest(string filepath, Version powershellVersion)
16671687
{
16681688
Token[] tokens;
@@ -1690,6 +1710,7 @@ public static bool IsModuleManifest(string filepath, Version powershellVersion)
16901710
}
16911711
var validKeys = GetModuleManifestKeys(powershellVersion);
16921712
var allKeys = validKeys.Concat(GetDeprecatedModuleManifestKeys());
1713+
16931714
// check if all the keys in hast.keyvaluepairs are present in keys
16941715
int matchCount = 0;
16951716
foreach(var pair in hast.KeyValuePairs)

0 commit comments

Comments
 (0)