Skip to content

Commit eca06e8

Browse files
prelim v2.4.0
1 parent 525756a commit eca06e8

24 files changed

+198
-196
lines changed

PSCalendar.psd1

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
RootModule = 'PSCalendar.psm1'
77

88
# Version number of this module.
9-
ModuleVersion = '2.3.2'
9+
ModuleVersion = '2.4.0'
1010

1111
# Supported PSEditions
1212
CompatiblePSEditions = @("Desktop", "Core")
@@ -29,18 +29,6 @@
2929
# Minimum version of the Windows PowerShell engine required by this module
3030
PowerShellVersion = '5.1'
3131

32-
# Name of the Windows PowerShell host required by this module
33-
# PowerShellHostName = ''
34-
35-
# Minimum version of the Windows PowerShell host required by this module
36-
# PowerShellHostVersion = ''
37-
38-
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
39-
# DotNetFrameworkVersion = ''
40-
41-
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
42-
# CLRVersion = ''
43-
4432
# Modules that must be imported into the global environment prior to importing this module
4533
RequiredModules = @("ThreadJob")
4634

@@ -51,16 +39,18 @@
5139
FormatsToProcess = @('formats\pscalendarconfiguration.format.ps1xml')
5240

5341
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
54-
FunctionsToExport = @('*')
55-
56-
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
57-
CmdletsToExport = @()
42+
FunctionsToExport = if ($PSEdition -eq 'Desktop') {
43+
"Get-Calendar","Show-Calendar","Get-NCalendar","Show-GuiCalendar","Show-PSCalendarHelp"
44+
}
45+
else {
46+
"Get-Calendar","Show-Calendar","Get-NCalendar","Show-PSCalendarHelp"
47+
}
5848

5949
# Variables to export from this module
6050
VariablesToExport = @()
6151

6252
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
63-
AliasesToExport = @('*')
53+
AliasesToExport = @('ncal','cal','gcal','scal')
6454

6555
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
6656
PrivateData = @{

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PSCalendar
1+
# PSCalendar Overview
22

33
[![PSGallery Version](https://img.shields.io/powershellgallery/v/PSCalendar.png?style=for-the-badge&logo=powershell&label=PowerShell%20Gallery)](https://www.powershellgallery.com/packages/PSCalendar/) [![PSGallery Downloads](https://img.shields.io/powershellgallery/dt/PSCalendar.png?style=for-the-badge&label=Downloads)](https://www.powershellgallery.com/packages/PSCalendar/)
44

@@ -24,27 +24,27 @@ __Note: If you are upgrading to v2.0.0 or later of this module, and have older v
2424

2525
The commands in this module have been updated to take advantage ANSI escape sequences. The main function, [Get-Calendar](docs/Get-Calendar.md), will display the current month in the console, highlighting the current date with an ANSI escape sequence.
2626

27-
![get-calendar](assets/get-calendar-v2.png)
27+
![get-calendar](images/get-calendar-v2.png)
2828

2929
But you can also specify a calendar by month and year.
3030

31-
![get calendar by month](assets/get-calendar-2.png)
31+
![get calendar by month](images/get-calendar-2.png)
3232

3333
In this example you can see that I specified dates to highlight. Or you can specify a range of months.
3434

35-
![get calendar range](assets/get-calendar-3.png)
35+
![get calendar range](images/get-calendar-3.png)
3636

3737
The function should be culturally aware. The commands in this module that have a `-Month` parameter should autocomplete to culture-specific month names.
3838

39-
![autocomplete months](assets/autocomplete-month.png)
39+
![autocomplete months](images/autocomplete-month.png)
4040

4141
There is a similar autocompletion for `-Year` that begins with the current year and then the next 5 years. Although nothing prevents you from entering any year you want.
4242

4343
## [Show-Calendar](docs/Show-Calendar.md)
4444

4545
In previous versions of this module, there was a command called `Show-Calendar` which wrote a colorized version of the calendar to the host using `Write-Host`. This command has been rewritten and now is essentially a wrapper for `Get-Calendar`. The primary difference is that you can position the calendar.
4646

47-
![Show-Calendar](assets/show-calendar-v2.png)
47+
![Show-Calendar](images/show-calendar-v2.png)
4848

4949
## A Console Calendar Prompt
5050

@@ -91,19 +91,23 @@ Function prompt {
9191

9292
Assuming the width of your console is at least 120, this code should work. Otherwise, you might need to tweak the positioning. This should also work in Windows Terminal. If you add some highlighted dates using `$PSDefaultParameterValues`, then you'll have a calendar right in front of you.
9393

94-
![console calendar](assets/console-calendar.png)
94+
![console calendar](images/console-calendar.png)
9595

9696
Note that any command output may be truncated because of the calendar display. This prompt function works as expected when using the Windows Terminal. Function needs work to behave as expected in a traditional PowerShell console where you might have a large buffer for scrolling.
9797

9898
## [Show-GUICalendar](docs/Show-GuiCalendar)
9999

100-
Finally, you can display a graphical calendar using a Windows Presentation Foundation (WPF) based script. The function runs the calendar-related code in a runspace so it does not block your prompt. You can display up to 3 months and specify dates to highlight.
100+
Finally, you can display a graphical calendar using a Windows Presentation Foundation (WPF) based script.
101+
102+
> :warning: This command is not supported in PowerShell 7 nor is it exported in the module.
103+
104+
The function runs the calendar-related code in a runspace so it does not block your prompt. You can display up to 3 months and specify dates to highlight.
101105

102106
```powershell
103107
PS C:\> Show-GuiCalendar 12/2018 2/2019 -highlight 12/24/18,12/25/18,12/31/18,1/1/19,1/18/19,2/14/19,2/22/19
104108
```
105109

106-
![show-guicalendar](assets/show-guicalendar.png)
110+
![show-guicalendar](images/show-guicalendar.png)
107111

108112
The calendar form is transparent. But you should be able to click on it to drag it around your screen. You can also use the `+` and `-` keys to increase or decrease the calendar's opacity. Be aware that if you close the PowerShell session that launched the calendar, the calendar too will close.
109113

@@ -113,23 +117,23 @@ Beginning with module version 2.2.0 you can also customize the calendar backgrou
113117
Show-GuiCalendar -BackgroundImage D:\images\blue-robot-ps-thumb.jpg -Stretch UniformToFill -FontWeight Bold
114118
```
115119

116-
![blue-psrobot-calendar](assets/calendar-background.png)
120+
![blue-psrobot-calendar](images/calendar-background.png)
117121

118122
Or you can specify a color. You can specify a WPF brush color like Cornsilk or Wheat, or use a color code like `#FFF000`:
119123

120124
```powershell
121125
Show-GuiCalendar -BackgroundColor "#FFF000"
122126
```
123127

124-
![calendar-backgroundcolor](assets/calendar-bgcolor.png)
128+
![calendar-backgroundcolor](images/calendar-bgcolor.png)
125129

126130
On Windows platforms, the `-BackgroundColor` parameter will autocomplete the available brush colors.
127131

128132
## [Get-NCalendar](docs/Get-NCalendar.md)
129133

130134
The Linux world has an *ncal* command which displays the month in a vertical fashion. `Get-NCalendar` and its alias `ncal` work in a similar manner. The default is for the current month and year.
131135

132-
![ncal](assets/ncal-1.png)
136+
![ncal](images/ncal-1.png)
133137

134138
The current date will be highlighted unless you use `-HideHighlight`. You must use the full month name, although there is tab completion.
135139

@@ -212,23 +216,23 @@ Show-GuiCalendar -Start 7/1/2021 -HighlightDate $h -BackgroundColor wheat -FontW
212216

213217
When you pass a hashtable, you will get a tooltip popup when you hover the mouse over the month.
214218

215-
![calendar-popup](assets/calendar-popup.png)g
219+
![calendar-popup](images/calendar-popup.png)g
216220

217221
This function requires the WPF-related assemblies. It should work in Windows PowerShell and PowerShell 7. You will receive a warning if any incompatibility is detected.
218222

219223
## Customizing the Calendar Appearance
220224

221225
Beginning with v2.0.0 of this module, ANSI escape sequences used to format the calendar are stored in module-scoped hashtable. You can use [Get-PSCalendarConfiguration](docs/Get-PSCalendarConfiguration.md) to view the current settings.
222226

223-
![configuration](assets/pscalendar-configuration-1.png)
227+
![configuration](images/pscalendar-configuration-1.png)
224228

225229
The output will show you the escape sequence appropriate for your PowerShell version. If you want to change a setting, you can use:
226230

227231
[Set-PSCalendarConfiguration](docs/Set-PSCalendarConfiguration.md)
228232

229233
You need to include the escape character but you do not need to include the closing escape sequence.
230234

231-
![change the configuration](assets/pscalendar-configuration-2.png)
235+
![change the configuration](images/pscalendar-configuration-2.png)
232236

233237
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.
234238

@@ -261,5 +265,3 @@ For example, if you are running under the `en-AU` culture, you would need to use
261265
## Potential Issues
262266

263267
I have tried to make this module culture-aware. Testing across cultures is not an easy process. If you encounter a problem and are not running PowerShell under the `EN-US` culture, run the calendar command you are trying to use with `-Verbose` and post the results in a new issue. Or if you have both Windows PowerShell and PowerShell 7 installed, try the same command in both versions.
264-
265-
Last Updated 2021-11-02 18:25:51Z

docs/Show-GuiCalendar.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Show-GuiCalendar [[-Start] <String>] [[-End] <String>]
2626
```yaml
2727
Show-GuiCalendar [[-Start] <String>] [[-End] <String>]
2828
[-HighlightDate <Object[]>] [-Font <String>] [-FontStyle <String>]
29-
[-FontWeight <String>] [-BackgroundImage <String>] [-Stretch <Stretch>]
29+
[-FontWeight <String>] [-BackgroundImage <String>] [-Stretch <String>]
3030
[-FirstDay <DayOfWeek>] [<CommonParameters>]
3131
```
3232

@@ -41,7 +41,7 @@ Show-GuiCalendar [[-Start] <String>] [[-End] <String>]
4141

4242
## DESCRIPTION
4343

44-
If you are running Windows PowerShell or a version of PowerShell that supports Windows Presentation Foundation (WPF), you can display a graphical calendar. You can specify up to 3 months. There are also parameters to fine-tune the calendar style. The calendar form itself is transparent, but you should be able to click on it to drag it around your screen. You can also use the + and - keys to increase or decrease the calendar's opacity. You may have to click on a calendar before making any adjustments.
44+
If you are running Windows PowerShell or a version of PowerShell that supports the [System.Windows.Media] .NET class, which does NOT include PowerShell 7, you can display a graphical calendar. You can specify up to 3 months. There are also parameters to fine-tune the calendar style. The calendar form itself is transparent, but you should be able to click on it to drag it around your screen. You can also use the + and - keys to increase or decrease the calendar's opacity. You may have to click on a calendar before making any adjustments.
4545

4646
This command launches the calendar in a separate runspace so that it doesn't block your prompt. However, if you close the PowerShell session that launched the calendar, the calendar will also automatically close.
4747

@@ -238,7 +238,7 @@ Accept wildcard characters: False
238238
Specify image stretch setting. Possible values are None, Fill, Uniform, and UniformToFill
239239
240240
```yaml
241-
Type: Stretch
241+
Type: String
242242
Parameter Sets: bgimage
243243
Aliases:
244244

0 commit comments

Comments
 (0)