Skip to content

Commit

Permalink
v2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Jul 10, 2021
1 parent 7853d5b commit 3cf4feb
Show file tree
Hide file tree
Showing 12 changed files with 334 additions and 361 deletions.
29 changes: 4 additions & 25 deletions PSCalendar.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
RootModule = 'PSCalendar.psm1'

# Version number of this module.
ModuleVersion = '2.0.0'
ModuleVersion = '2.1.0'

# Supported PSEditions
CompatiblePSEditions = @("Desktop", "Core")
Expand All @@ -21,7 +21,7 @@
CompanyName = 'JDH Information Technology Solutions, Inc.'

# Copyright statement for this module
Copyright = '(c) 2018-2020 JDH Information Technology Solutions, Inc. All rights reserved.'
Copyright = '(c) 2018-2021 JDH Information Technology Solutions, Inc. All rights reserved.'

# Description of the functionality provided by this module
Description = 'A PowerShell module to display a calendar in the console.'
Expand All @@ -41,29 +41,17 @@
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# CLRVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @("ThreadJob")

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
FormatsToProcess = @('formats\pscalendarconfiguration.format.ps1xml')

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# 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.
FunctionsToExport = @("*")
FunctionsToExport = @('*')

# 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.
CmdletsToExport = @()
Expand All @@ -72,16 +60,7 @@
VariablesToExport = @()

# 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.
AliasesToExport = @("*")

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()
AliasesToExport = @('*')

# 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.
PrivateData = @{
Expand Down
7 changes: 5 additions & 2 deletions PSCalendar.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if ($IsCoreCLR) {
$esc = "`e"
}
else {
$esc = [Char]0x1b
$esc = [Char]27
}

$PSCalendarConfiguration = @{
Expand Down Expand Up @@ -48,4 +48,7 @@ If ($IsWindows -OR ($PSEdition -eq 'Desktop')) {
}
else {
Export-ModuleMember -Function 'Get-Calendar', 'Show-Calendar', 'Get-PSCalendarConfiguration', 'Set-PSCalendarConfiguration' -Alias scal
}
}

#use this version in verbose output to reflect module version
$modver = (Test-ModuleManifest $PSScriptRoot\PSCalendar.psd1).Version
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ One way you might want to use this is in your PowerShell console. You can use th

```powershell
#requires -modules @{ModuleName="PSCalendar";ModuleVersion="1.10.0"}
#requires -modules @{ModuleName="PSCalendar";ModuleVersion="2.1.0"}
Function prompt {
Expand Down Expand Up @@ -121,8 +121,18 @@ You need to include the escape character but you do not need to include the clos

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.

## A Note on Culture

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:

```powershell
(Get-Culture).datetimeformat.ShortDatePattern
```

## Potential Issues

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

*I'm tracking a potential discrepancy in how .NET returns culture information between the two PowerShell versions when using this module in PowerShell 7. If you use the module in Windows PowerShell, it should work as expected.*

Last Updated *2020-09-02 14:17:47Z*
Last Updated *2021-07-09 14:12:41Z*
38 changes: 23 additions & 15 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Change Log for PSCalendar

## v2.1.0

+ Updated license.txt
+ Updated module commands to better handle datetime values when running under different cultures. Many parameters are now being treated as strings so they can be properly converted. [Issue #22](https://github.com/jdhitsolutions/PSCalendar/issues/22).
+ Updated private function that generates function to display enough weeks to complete a month. [Issue #21](https://github.com/jdhitsolutions/PSCalendar/issues/21).
+ Updated help files.
+ Updated `README.md`.

## v2.0.0

__This is a major update of the module with many breaking changes__

+ Complete re-write of `Get-Calendar` that now uses to ANSI escape sequences for coloring and highlighting. (Issue #17)
+ Complete re-write of `Get-Calendar` that now uses to ANSI escape sequences for coloring and highlighting. [Issue #17](https://github.com/jdhitsolutions/PSCalendar/issues/17).
+ Fixed issue with double-highlighting of the current day when it was found twice. (Issue #20)
+ Removed obsolete parameters from `Show-Calendar`.
+ Module reorganization to better handle non-Windows platforms. Platform-specific commands and aliases are exported in `PSCalendar.psm1`.(Issue #18)
Expand All @@ -14,7 +22,7 @@ __This is a major update of the module with many breaking changes__

## v1.11.0

+ Add `ThreadJob` as a required module. (Issue #19)
+ Add `ThreadJob` as a required module. [Issue #19](https://github.com/jdhitsolutions/PSCalendar/issues/19)

## v1.10.0

Expand All @@ -25,14 +33,14 @@ __This is a major update of the module with many breaking changes__
## v1.9.0

+ Modified manifest to export all public functions and aliases
+ Modified `Show-GuiCalendar` to attempt to load WPF libraries and display a warning if it can't. (Issue #13)
+ Added a private helper function, `New-RunspaceCleanUpJob` to cleanup runspaces when using `Show-GuiCalendar`. Thanks to @oising for leading me down the right path. (Issue #12)
+ Modified `Get-Calendar` and `Show-Calendar` to display better under different cultures. (Issue #11)
+ Modified `Show-GuiCalendar` to attempt to load WPF libraries and display a warning if it can't. [Issue #13](https://github.com/jdhitsolutions/PSCalendar/issues/13)
+ Added a private helper function, `New-RunspaceCleanUpJob` to cleanup runspaces when using `Show-GuiCalendar`. Thanks to @oising for leading me down the right path. [Issue #12](https://github.com/jdhitsolutions/PSCalendar/issues/12)
+ Modified `Get-Calendar` and `Show-Calendar` to display better under different cultures. [Issue #11](https://github.com/jdhitsolutions/PSCalendar/issues/11)
+ Updated Pester tests

## v1.8.0

+ Modified commands to begin on the correct day of the week. (Issue #10)
+ Modified commands to begin on the correct day of the week. [Issue #10](https://github.com/jdhitsolutions/PSCalendar/issues/10)
+ Switched to using .NET culture classes directly instead of `Get-Culture` for better international results
+ Corrected license file for GitHub
+ Code cleanup to replace `Out-Null` with `[void]`
Expand All @@ -41,15 +49,15 @@ __This is a major update of the module with many breaking changes__

## v1.7.0

+ More changes to better handle culture in `Get-Calendar` (Issue #9)
+ More changes to better handle culture in `Get-Calendar` [Issue #9](https://github.com/jdhitsolutions/PSCalendar/issues/9)
+ Added more verbose messages to `Get-Calendar`
+ Added missing `gcal` alias for `Show-GuiCalendar`
+ Revised Pester tests
+ Updated `README.md`

## v1.6.0

+ Fixing date parsing bug for different cultures (Issue #9)
+ Fixing date parsing bug for different cultures [Issue #9](https://github.com/jdhitsolutions/PSCalendar/issues/9)
+ Manifest updates to better accommodate PowerShell Core and Windows PowerShell
+ Updated `README.md`

Expand All @@ -68,31 +76,31 @@ __This is a major update of the module with many breaking changes__

## v1.4.0

+ Added parameters to `Show-Calendar` to let the user specify colors. (Issue #4)
+ Fixed highlight display bug in `Get-Calendar` (Issue #8)
+ Added parameters to `Show-Calendar` to let the user specify colors. [Issue #4](https://github.com/jdhitsolutions/PSCalendar/issues/4)
+ Fixed highlight display bug in `Get-Calendar` [Issue #8](https://github.com/jdhitsolutions/PSCalendar/issues/8)
+ Fixed DisplayMode bug in `Show-GuiCalendar`
+ Modified `Show-GuiCalendar` to not display in the taskbar
+ Added Pester tests to the module
+ Updated documentation

## v1.3.1

+ Help documentation updates for clarity (Issue #5)
+ Fixed HighLightDay parsing bug (Issue #6)
+ Help documentation updates for clarity [Issue #5](https://github.com/jdhitsolutions/PSCalendar/issues/5)
+ Fixed HighLightDay parsing bug [Issue #6](https://github.com/jdhitsolutions/PSCalendar/issues/6)

## v1.3.0

+ Added WPF calendar function `Show-GuiCalendar` (Issue #3)
+ Added WPF calendar function `Show-GuiCalendar` [Issue #3](https://github.com/jdhitsolutions/PSCalendar/issues/3)
+ Added alias `gcal` for `Show-GuiCalendar`
+ Added parameter validation to `-End` to make sure it is after `-Start`
+ Updated `README.md`

## v1.2.0

+ Added validation for `-Month` (Issue #1)
+ Added validation for `-Month` [Issue #1](https://github.com/jdhitsolutions/PSCalendar/issues/1)
+ Made `-Year` a positional parameter in the 2nd position
+ some minor code cleanup
+ Added a private helper function to enumerate month names (Issue #2)
+ Added a private helper function to enumerate month names [Issue #2](https://github.com/jdhitsolutions/PSCalendar/issues/2)

## v1.1.0

Expand Down
40 changes: 25 additions & 15 deletions docs/Get-Calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,49 @@ Displays a visual representation of a calendar.
### month (Default)

```yaml
Get-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <DateTime[]>] [<CommonParameters>]
Get-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <String[]>] [<CommonParameters>]
```

### span

```yaml
Get-Calendar -Start <DateTime> -End <DateTime> [-HighlightDate <DateTime[]>] [<CommonParameters>]
Get-Calendar -Start <String> -End <String> [-HighlightDate <String[]>] [<CommonParameters>]
```

## DESCRIPTION

This command displays a visual representation of a calendar. It supports multiple months, as well as the ability to highlight a specific date or dates. The default display uses ANSI escape sequences. You can adjust the color scheme using Set-PSCalendarConfiguration.

When you enter Highlight, Start, or End dates, be sure to use the format that is culturally appropriate. It should match the pattern you get from running this command:

(Get-Culture).datetimeformat.ShortDatePattern

## EXAMPLES

### EXAMPLE 1

```powershell
PS C:\> Get-Calendar
September 2020
July 2021
Sun Mon Tue Wed Thu Fri Sat
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
```

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

### EXAMPLE 2

```powershell
PS C:\> Get-Calendar -start "3/1/2020" -end "5/1/2020"
PS C:\> Get-Calendar -start "3/1/2021" -end "5/1/2021"
```

Display monthly calendars from March to May, 2020.
Display monthly calendars from March to May, 2021.

### EXAMPLE 3

Expand Down Expand Up @@ -110,10 +114,12 @@ Accept wildcard characters: False
### -Start
The first month to display.
The first month to display. You must format the dates to match your culture. It should match the pattern you get from running this command:
(Get-Culture).datetimeformat.ShortDatePattern
```yaml
Type: DateTime
Type: String
Parameter Sets: span
Aliases:

Expand All @@ -126,10 +132,12 @@ Accept wildcard characters: False
### -End
The last month to display.
The last month to display. You must format the dates to match your culture. It should match the pattern you get from running this command:
(Get-Culture).datetimeformat.ShortDatePattern
```yaml
Type: DateTime
Type: String
Parameter Sets: span
Aliases:

Expand All @@ -142,10 +150,12 @@ Accept wildcard characters: False
### -HighlightDate
Specific days (named) to highlight. These dates are color formatted using ANSI escape sequences.
Specific days (named) to highlight. These dates are color formatted using ANSI escape sequences. You must format the dates to match your culture. It should match the pattern you get from running this command:
(Get-Culture).datetimeformat.ShortDatePattern
```yaml
Type: DateTime[]
Type: String[]
Parameter Sets: (All)
Aliases:

Expand Down
2 changes: 1 addition & 1 deletion docs/Get-PSCalendarConfiguration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSCalendar-help.xml
Module Name: PSCalendar
online version: https://github.com/jdhitsolutions/PSCalendar/blob/master/docs/Get-PSCalendarConfiguration.md
online version: https://bit.ly/3htAFNM
schema: 2.0.0
---

Expand Down
6 changes: 3 additions & 3 deletions docs/Set-PSCalendarConfiguration.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
external help file: PSCalendar-help.xml
Module Name: PSCalendar
online version: https://github.com/jdhitsolutions/PSCalendar/blob/master/docs/Set-PSCalendarConfiguration.md
online version: https://bit.ly/2Vli4uJ
schema: 2.0.0
---

Expand All @@ -14,8 +14,8 @@ Modify the PSCalendar ANSI configuration.
## SYNTAX

```yaml
Set-PSCalendarConfiguration [[-Title] <String>] [[-DayOfWeek] <String>] [[-Today] <String>]
[[-Highlight] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Set-PSCalendarConfiguration [[-Title] <String>] [[-DayOfWeek] <String>]
[[-Today] <String>] [[-Highlight] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand Down
10 changes: 4 additions & 6 deletions docs/Show-Calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ Display a colorized calendar month in the console.
## SYNTAX

```yaml
Show-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <DateTime[]>] [-Position <Coordinates>]
[<CommonParameters>]
Show-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <String[]>] [-Position <Coordinates>] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -84,16 +83,16 @@ Accept wildcard characters: False
### -HighlightDate
Specify days to highlight. These dates are colored by ANSI escape sequences. You can modify them with Set-PSCalendarConfiguration.
Specify days to highlight. These dates are colored by ANSI escape sequences. You can modify them with Set-PSCalendarConfiguration. You must format the dates tpo match your culture. It should match the pattern you get from running this command: (Get-Culture).datetimeformat.ShortDatePattern
```yaml
Type: DateTime[]
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value:
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
Expand All @@ -115,7 +114,6 @@ Accept wildcard characters: False
```
### CommonParameters
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).
## INPUTS
Expand Down
Loading

0 comments on commit 3cf4feb

Please sign in to comment.