ValeApplicationInfo
The ValeApplicationInfo represents the Vale binary available on a machine.
2 minute read
Definition
Source Code
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
class ValeApplicationInfo {
[System.Management.Automation.CommandTypes]
$CommandType
[string]
$Definition
[string]
$Extension
[psmoduleinfo]
$Module
[string]
$ModuleName
[string]
$Name
[System.Collections.ObjectModel.ReadOnlyCollection[System.Management.Automation.PSTypeName]]
$OutputType
[System.Collections.Generic.Dictionary[string, System.Management.Automation.ParameterMetadata]]
$Parameters
[System.Collections.ObjectModel.ReadOnlyCollection[System.Management.Automation.CommandParameterSetInfo]]
$ParameterSets
[string]
$Path
[System.Management.Automation.RemotingCapability]
$RemotingCapability
[string]
$Source
[version]
$Version
[System.Management.Automation.SessionStateEntryVisibility]
$Visibility
ValeApplicationInfo() {}
ValeApplicationInfo([System.Management.Automation.ApplicationInfo]$Info) {
$InfoProperties = $Info
| Get-Member -MemberType Property
| Select-Object -ExpandProperty Name
foreach ($Property in $InfoProperties) {
$this.$Property = $Info.$Property
}
if (($Output = & $Info --version) -match 'vale version (?<VersionString>\S+)') {
$this.Version = [version]($Matches.VersionString)
} else {
throw "Unable to find version string from 'vale --version' output: $Output"
}
}
[string] ToString() {
return $this.Source
}
}
An instance of the ValeApplicationInfo class has the same properties as the [System.Management.Automation.ApplicationInfo](https://learn.microsoft.com/dotnet/api/System.Management.Automation.ApplicationInfo) type but with the Version property correctly reflecting Vale’s actual version.
Examples
1. Checking Vale’s Version
This example shows the difference between calling Get-Command
on a Vale binary and the output of
the Get-Vale
command. Only the latter shows the correct version information for Vale.
Get-Command ./.vale/vale
Get-Vale
CommandType Name Version Source
----------- ---- ------- ------
Application vale.exe 0.0.0.0 C:\code\pwsh\Documentarian\.vale\vale.exe
Application vale.exe 2.24.0 C:\code\pwsh\Documentarian\.vale\vale.exe
Constructors
ValeApplicationInfo()
- Initializes a new instance of the ValeApplicationInfo class.
Methods
ToString()
- Returns the string representation of a ValeApplicationInfo instance.
Properties
- CommandType
- Lists the type of the command.
- Definition
- Gets the path of the Vale program file.
- Extension
- Gets the extension of the Vale program file.
- Module
- This value is always null for Vale.
- ModuleName
- This value is always null for Vale.
- Name
- Gets the name of the Vale program file.
- OutputType
- Gets the output type.
- Parameters
- This value is always null for Vale.
- ParameterSets
- This value is always null for Vale.
- Path
- Gets the full path to the Vale program file.
- RemotingCapability
- Gets the remoting capabilities of this cmdlet.
- Source
- Gets the source of this command
- Version
- Gets the version of the Vale application.
- Visibility
- Gets the visibility of Vale.
Last modified March 10, 2023: (GH-71) Document Vale classes (ad1e42a)