- Notifications
You must be signed in to change notification settings - Fork 187
/
Copy pathReadModuleReadMe.ps1
17 lines (17 loc) · 674 Bytes
/
ReadModuleReadMe.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $ReadMePath,
[Parameter(Mandatory=$true)][ValidateNotNullOrEmpty()][string] $FieldToRead
)
$ErrorActionPreference="Stop"
$FieldValue=$null
# Read readme.md.
$ReadMeContent=Get-Content$ReadMePath-Delimiter "### Versioning"
if ($ReadMeContent.Length-eq2) {
# Convert versioning section to yaml.
$VersioningSection=$ReadMeContent[1].Replace("``","").Replace("yaml","") |ConvertFrom-Yaml
$FieldValue=$VersioningSection[$FieldToRead]
}
return$FieldValue