Skip to content

Commit 5d150f8

Browse files
v2.8.0
1 parent 731fe85 commit 5d150f8

17 files changed

+288
-75
lines changed

PSCalendar.psd1

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55

66
RootModule = 'PSCalendar.psm1'
7-
ModuleVersion = '2.7.0'
7+
ModuleVersion = '2.8.0'
88
CompatiblePSEditions = @("Desktop", "Core")
99
GUID = '222beda0-cdb5-464d-bf49-7ab701da86c9'
1010
Author = 'Jeff Hicks'
1111
CompanyName = 'JDH Information Technology Solutions, Inc.'
12-
Copyright = '(c) 2018-2021 JDH Information Technology Solutions, Inc. All rights reserved.'
12+
Copyright = '(c) 2018-2022 JDH Information Technology Solutions, Inc. All rights reserved.'
1313
Description = 'A PowerShell module to display a calendar in the console.'
1414
PowerShellVersion = '5.1'
1515
RequiredModules = @("ThreadJob")
@@ -33,31 +33,15 @@
3333
PrivateData = @{
3434

3535
PSData = @{
36-
37-
# Tags applied to this module. These help with module discovery in online galleries.
3836
Tags = @('calendar', 'reminder', 'wpf', 'ncal')
39-
40-
# A URL to the license for this module.
4137
LicenseUri = 'https://github.com/jdhitsolutions/PSCalendar/blob/master/license.txt'
42-
43-
# A URL to the main website for this project.
4438
ProjectUri = 'https://github.com/jdhitsolutions/PSCalendar'
45-
46-
# A URL to an icon representing this module.
4739
# IconUri = ''
48-
49-
# ReleaseNotes of this module
5040
ReleaseNotes = 'https://github.com/jdhitsolutions/PSCalendar/blob/master/README.md'
5141

5242
} # End of PSData hashtable
5343

5444
} # End of PrivateData hashtable
5545

56-
# HelpInfo URI of this module
57-
# HelpInfoURI = ''
58-
59-
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
60-
# DefaultCommandPrefix = ''
61-
6246
}
6347

PSCalendar.psm1

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ $PSCalendarConfiguration = @{
2222
Highlight = "$esc[92m"
2323
}
2424

25-
#define a function to open the doeumentation pdf file
26-
Function Show-PSCalendarHelp {
27-
[cmdletbinding()]
28-
param()
29-
30-
Start-process $PSScriptRoot\PSCalendarManual.pdf
31-
}
32-
3325
#define an auto completer for the Month parameter
3426
Register-ArgumentCompleter -CommandName Get-Calendar, Show-Calendar,Get-NCalendar -ParameterName Month -ScriptBlock {
3527
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
@@ -84,4 +76,4 @@ else {
8476
}
8577

8678
#use this version in verbose output to reflect module version
87-
$modver = (Test-ModuleManifest $PSScriptRoot\PSCalendar.psd1).Version
79+
$modver = (Test-ModuleManifest $PSScriptroot\PSCalendar.psd1).Version

PSCalendarManual.pdf

52.4 KB
Binary file not shown.

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,16 @@ You need to include the escape character but you do not need to include the clos
236236

237237
This change lasts for the duration of your PowerShell session. If you want to make it more permanent, you will need to add the commands to your PowerShell profile script.
238238

239+
## ANSI Support
240+
241+
As you've seen, there are several commands in this module that rely on ANSI for formatting. The hosting application needs to be able to recognize and use ANSI escape sequences. These commands should work in both Windows PowerShell and PowerShell 7 in the traditional PowerShell consoles or in Windows Terminal. They will not work in the PowerShell ISE. ANSI-related output will be automatically disabled if the PowerShell ISE is detected.
242+
243+
If you aren't sure if your host supports ANSI, run `Get-PSReadlineOption`. You should see something like this:
244+
245+
![PSReadlineOptions](images/psreadlineoptions.png)
246+
247+
If you don't see color formatting, the hosting application doesn't support ANSI.
248+
239249
## A Note on Culture
240250

241251
I've tried very hard to make the commands respect culture. Most commands now that string values to represent dates which are then treated as dates internally. For this reason, it is important that you follow the culture-specific short date format that you get from running this command:

Show-PSCalendarHelp.ps1

Lines changed: 0 additions & 6 deletions
This file was deleted.

changelog.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Change Log for PSCalendar
22

3+
## v2.8.0
4+
5+
+ Updated `Get-Calendar` and `Show-Calendar` with a new parameter `MonthOnly` to only show days from the specified month. This will remove leading and trailing days from other months. [Issue #29](https://github.com/jdhitsolutions/PSCalendar/issues/29). Much thanks to [Matthew Gray](https://github.com/scriptingstudio) for the suggestions and code snippet.
6+
+ Updated `Get-Calendar`, `Show-Calendar`, and `Get-NCalendar` to suppress all ANSI formatting when running in the PowerShell ISE. [Issue #30](https://github.com/jdhitsolutions/PSCalendar/issues/30)
7+
+ Moved `Show-PSCalendarHelp` to a separate file under Functions.
8+
+ Documentation updates.
9+
+ Updated `README.md`.
10+
+ Help updates.
11+
12+
## v2.7.0
13+
14+
+ Updates to `Get-NCalendar` [Issue #25](https://github.com/jdhitsolutions/PSCalendar/issues/25). Much thanks to [atkinsroy](https://github.com/atkinsroy) for excellent suggestions and code examples.
15+
+ Restructured module layout.
16+
+ Updated Pester tests.
17+
+ Help updates.
18+
319
## v2.6.0
420

521
+ Updates to `Get-NCalendar` [Issue #25](https://github.com/jdhitsolutions/PSCalendar/issues/25).

docs/Get-Calendar.md

Lines changed: 43 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ Displays a visual representation of a calendar.
1616
### month (Default)
1717

1818
```yaml
19-
Get-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-NoANSI] [<CommonParameters>]
19+
Get-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-NoANSI] [-MonthOnly] [<CommonParameters>]
2020
```
2121

2222
### span
2323

2424
```yaml
25-
Get-Calendar -Start <String> -End <String> [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-NoANSI] [<CommonParameters>]
25+
Get-Calendar -Start <String> -End <String> [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-NoANSI] [-MonthOnly] [<CommonParameters>]
2626
```
2727

2828
## DESCRIPTION
@@ -35,7 +35,7 @@ When you enter Highlight, Start, or End dates, be sure to use the format that is
3535

3636
## EXAMPLES
3737

38-
### EXAMPLE 1
38+
### Example 1
3939

4040
```powershell
4141
PS C:\> Get-Calendar
@@ -52,15 +52,15 @@ PS C:\> Get-Calendar
5252

5353
Show the current month. The current day will be formatted in color.
5454

55-
### EXAMPLE 2
55+
### Example 2
5656

5757
```powershell
5858
PS C:\> Get-Calendar -start "3/1/2021" -end "5/1/2021"
5959
```
6060

6161
Display monthly calendars from March to May, 2021.
6262

63-
### EXAMPLE 3
63+
### Example 3
6464

6565
```powershell
6666
PS C:\> Get-Calendar December -HighlightDate 12/4/2020,12/25/2020,12/24/2020,12/31/2020
@@ -78,7 +78,7 @@ PS C:\> Get-Calendar December -HighlightDate 12/4/2020,12/25/2020,12/24/2020,12/
7878

7979
Display a month and highlight specific dates in color.
8080

81-
### EXAMPLE 4
81+
### Example 4
8282

8383
```powershell
8484
PS C:\> Get-Calendar august -firstday Monday -highlight 1/8/2021,15,8,2021
@@ -96,14 +96,32 @@ PS C:\> Get-Calendar august -firstday Monday -highlight 1/8/2021,15,8,2021
9696

9797
In Windows PowerShell, all of the commands appear to respect culture settings. However, when running in PowerShell 7 there appears to be a bug in .NET Core and how it returns culture information for some cultures, specifically the first day of the week. If you run `Get-Calendar` or `Show-Calendar` and the week begins on the wrong day, use the `FirstDay` parameter to override the detected .NET values with the correct one. If you are running under the en-AU culture in PowerShell 7, you would need to run this command.
9898

99-
### EXAMPLE 5
99+
### Example 5
100100

101101
```powershell
102102
PS C:\> Get-Calendar -NoANSI -Start 7/1/2021 -end 9/1/2021 | Out-File c:\work\Q3.txt
103103
```
104104

105105
Get the calendars for a month of ranges with no ANSI formatting and save the output to a text file.
106106

107+
### Example 6
108+
109+
```powershell
110+
PS C:\> Get-Calendar -Month January -Year 2022 -NoANSI -MonthOnly
111+
112+
January 2022
113+
114+
Sun Mon Tue Wed Thu Fri Sat
115+
1
116+
2 3 4 5 6 7 8
117+
9 10 11 12 13 14 15
118+
16 17 18 19 20 21 22
119+
23 24 25 26 27 28 29
120+
30 31
121+
```
122+
123+
Suppress leading and trailing days from other months with the MonthOnly parameter.
124+
107125
## PARAMETERS
108126

109127
### -Month
@@ -210,7 +228,23 @@ Accept wildcard characters: False
210228
211229
### -NoANSI
212230
213-
Do not use any ANSI formatting. The output will be plain-text. This also means that the current day and highlight dates will not be reflected in the output.
231+
Do not use any ANSI formatting. The output will be plain-text. This also means that the current day and highlight dates will not be reflected in the output. This parameter has no affect when running the command in the PowerShell ISE. There is no color formatting when using this host.
232+
233+
```yaml
234+
Type: SwitchParameter
235+
Parameter Sets: (All)
236+
Aliases:
237+
238+
Required: False
239+
Position: Named
240+
Default value: None
241+
Accept pipeline input: False
242+
Accept wildcard characters: False
243+
```
244+
245+
### -MonthOnly
246+
247+
Do not show any leading or trailing days from other months.
214248
215249
```yaml
216250
Type: SwitchParameter
@@ -224,7 +258,7 @@ Accept pipeline input: False
224258
Accept wildcard characters: False
225259
```
226260
227-
### CommonParameters
261+
### CommonParameters.
228262
229263
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
230264

docs/Get-NCalendar.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Get-NCalendar [[-Month] <String>] [[-Year] <Int32>] [-HideHighlight] [-Monday] [
2121

2222
This command generates equivalent output to the ncal Linux command. This is not a 100% port of that command but it should provide similar results for the same month and year. You should enter the complete month name. There should be tab-completion for the month and year values. This command has an alias of ncal on Windows platforms.
2323

24+
If you run this command in the PowerShell ISE, there will be no highlighting or ANSI formatting.
25+
2426
## EXAMPLES
2527

2628
### Example 1
@@ -119,7 +121,7 @@ Accept wildcard characters: False
119121
120122
### -HideHighlight
121123
122-
Don't highlight the current date.
124+
Don't highlight the current date. This parameter is automatically set to true when running in the PowerShell ISE.
123125
124126
```yaml
125127
Type: SwitchParameter

docs/Show-Calendar.md

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Display a colorized calendar month in the console.
1414
## SYNTAX
1515

1616
```yaml
17-
Show-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-Position <Coordinates>] [<CommonParameters>]
17+
Show-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-Position <Coordinates>] [-MonthOnly] [<CommonParameters>]
1818
```
1919

2020
## DESCRIPTION
@@ -23,15 +23,15 @@ This command is a wrapper for Get-Calendar that essentially shows the same resul
2323

2424
## EXAMPLES
2525

26-
### EXAMPLE 1
26+
### Example 1
2727

2828
```powershell
2929
PS C:\> Show-Calendar
3030
```
3131

3232
Display a colorized version of the current month.
3333

34-
### EXAMPLE 2
34+
### Example 2
3535

3636
```powershell
3737
PS C:\> Show-Calendar -Month February -Year 2021 -HighlightDate 2/22/21
@@ -47,6 +47,24 @@ PS C:\> Show-Calendar -Position ([system.management.automation.host.coordinates
4747

4848
Display the calendar at a specified X,Y position in the console. This parameter will probably not work in the PowerShell ISE.
4949

50+
### Example 4
51+
52+
```powershell
53+
PS C:\> Show-Calendar -Month January -Year 2022 -MonthOnly
54+
55+
January 2022
56+
57+
Sun Mon Tue Wed Thu Fri Sat
58+
1
59+
2 3 4 5 6 7 8
60+
9 10 11 12 13 14 15
61+
16 17 18 19 20 21 22
62+
23 24 25 26 27 28 29
63+
30 31
64+
```
65+
66+
Suppress leading and trailing days from other months with the MonthOnly parameter.
67+
5068
## PARAMETERS
5169

5270
### -Month
@@ -129,7 +147,24 @@ Accept pipeline input: False
129147
Accept wildcard characters: False
130148
```
131149
150+
### -MonthOnly
151+
152+
Do not show any leading or trailing days.
153+
154+
```yaml
155+
Type: SwitchParameter
156+
Parameter Sets: (All)
157+
Aliases:
158+
159+
Required: False
160+
Position: Named
161+
Default value: None
162+
Accept pipeline input: False
163+
Accept wildcard characters: False
164+
```
165+
132166
### CommonParameters
167+
133168
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
134169
135170
## INPUTS

0 commit comments

Comments
 (0)