Created
March 12, 2020 22:59
-
-
Save kilasuit/4fed011a067377dadc2f00d1fafe8088 to your computer and use it in GitHub Desktop.
Example Question in Profile
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
function Request-YesOrNo { | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Mandatory=$false, Position=1)] | |
[string]$title="Confirm", | |
[Parameter(Mandatory=$true, Position=2)] | |
[string]$message="Are you sure?" | |
) | |
$choiceYes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Answer Yes." | |
$choiceNo = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Answer No." | |
$options = [System.Management.Automation.Host.ChoiceDescription[]]($choiceYes, $choiceNo) | |
try { | |
$result = $host.ui.PromptForChoice($title, $message, $options, 1) | |
} | |
catch [Management.Automation.Host.PromptingException] { | |
$result = $choiceNo | |
} | |
switch ($result) { | |
0 { $true } | |
1 { $false } | |
} | |
} | |
Import-Module AdditionalGitThings | |
$CheckGit = Request-YesOrNo -message 'Want to Check GitHub Status?' | |
If ($CheckGit -eq $true) { Check-GithubRepoStatus } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment