Skip to content

Commit ff97ef8

Browse files
🚀 [Feature]: Add Get-Greeting function (#11)
Adds a new `Get-Greeting` function that returns a greeting message based on the time of day. This provides a simple utility for generating contextual greetings in scripts and modules. - Related to PSModule/Process-PSModule#263 (testing PR-based release notes) ## New Function The `Get-Greeting` function accepts an optional `-TimeOfDay` parameter with values `Morning`, `Afternoon`, or `Evening`, defaulting to `Morning`. ```powershell # Returns "Good Morning!" Get-Greeting # Returns "Good Evening!" Get-Greeting -TimeOfDay 'Evening' ``` ## Tests Added tests to verify the function works correctly with the default parameter and explicit time of day values.
1 parent 55de693 commit ff97ef8

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

.github/workflows/Process-PSModule.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ permissions:
2727

2828
jobs:
2929
Process-PSModule:
30-
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@v5
30+
uses: PSModule/Process-PSModule/.github/workflows/workflow.yml@releasenotes
3131
secrets:
3232
APIKey: ${{ secrets.APIKey }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function Get-Greeting {
2+
<#
3+
.SYNOPSIS
4+
Returns a greeting message.
5+
6+
.DESCRIPTION
7+
Returns a simple greeting message for the specified time of day.
8+
9+
.EXAMPLE
10+
Get-Greeting -TimeOfDay 'Morning'
11+
12+
Returns "Good Morning!"
13+
#>
14+
[OutputType([string])]
15+
[CmdletBinding()]
16+
param (
17+
# The time of day for the greeting.
18+
[Parameter()]
19+
[ValidateSet('Morning', 'Afternoon', 'Evening')]
20+
[string] $TimeOfDay = 'Morning'
21+
)
22+
"Good $TimeOfDay!"
23+
}

tests/PSModuleTest.Tests.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,12 @@ Describe 'Module' {
1313
It 'Function: Get-PSModuleTest' {
1414
Get-PSModuleTest -Name 'World' | Should -Be 'Hello, World!'
1515
}
16+
17+
It 'Function: Get-Greeting - Default' {
18+
Get-Greeting | Should -Be 'Good Morning!'
19+
}
20+
21+
It 'Function: Get-Greeting - Evening' {
22+
Get-Greeting -TimeOfDay 'Evening' | Should -Be 'Good Evening!'
23+
}
1624
}

0 commit comments

Comments
 (0)