-
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
User can now specify regexes used to find binaries (#833)
* reverted CreateSourceFolder * Made upstream more generic * Added windows logos to wix installer resources * Fixed issues with cmd * Updated jvm finding * Added header and params * fixed typo * Updated ARCH for Microsoft * Moved windows logos to seperate branch * Added 'x86' to list of valid inputs * Updated README.md
- Loading branch information
Showing
4 changed files
with
132 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<# | ||
.SYNOPSIS | ||
This script verifies the validity an input, given a list of possible inputs. | ||
.DESCRIPTION | ||
The script takes a string as input and checks if it is valid against a list of valid inputs. | ||
If the input is valid, the script returns 0. If the input is invalid, the script returns 1. | ||
.PARAMETER validInputs | ||
A comma seperated list of valid inputs. | ||
.PARAMETER toValidate | ||
The input to be verified. | ||
.PARAMETER delimiter | ||
The delimiter used to split the input string. Default is a space. | ||
.NOTES | ||
File Name: Validate-Input.ps1 | ||
Author : Joshua Martin-Jaffe | ||
Version : 1.0 | ||
Date : Feb. 29, 2024 | ||
.EXAMPLE | ||
PS> .\Validate-Input.ps1 -validInputs 'x86-32 x64' -toValidate 'x86-32 x64' -delimiter ' ' | ||
True | ||
#> | ||
|
||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[string]$validInputs, | ||
[Parameter(Mandatory = $true)] | ||
[string]$toValidate, | ||
[Parameter(Mandatory = $true)] | ||
[string]$delimiter | ||
) | ||
|
||
$validInputs = $validInputs.Trim("'") | ||
$validInputArray = $validInputs -split "$delimiter" | ||
|
||
$toValidate = $toValidate.Trim("'") | ||
$inputArray = $toValidate -split "$delimiter" | ||
|
||
|
||
for ($i = 0; $i -lt $inputArray.Length; $i++) { | ||
if ($validInputArray -notcontains $inputArray[$i]) { | ||
echo $inputArray[$i] ' is an invalid input' | ||
exit 1 # Invalid input | ||
} | ||
} | ||
exit 0 # Valid input |