Skip to content

Commit

Permalink
v2.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jdhitsolutions committed Mar 1, 2022
1 parent 731fe85 commit 5d150f8
Show file tree
Hide file tree
Showing 17 changed files with 288 additions and 75 deletions.
20 changes: 2 additions & 18 deletions PSCalendar.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@


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

PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = @('calendar', 'reminder', 'wpf', 'ncal')

# A URL to the license for this module.
LicenseUri = 'https://github.com/jdhitsolutions/PSCalendar/blob/master/license.txt'

# A URL to the main website for this project.
ProjectUri = 'https://github.com/jdhitsolutions/PSCalendar'

# A URL to an icon representing this module.
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = 'https://github.com/jdhitsolutions/PSCalendar/blob/master/README.md'

} # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}

10 changes: 1 addition & 9 deletions PSCalendar.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ $PSCalendarConfiguration = @{
Highlight = "$esc[92m"
}

#define a function to open the doeumentation pdf file
Function Show-PSCalendarHelp {
[cmdletbinding()]
param()

Start-process $PSScriptRoot\PSCalendarManual.pdf
}

#define an auto completer for the Month parameter
Register-ArgumentCompleter -CommandName Get-Calendar, Show-Calendar,Get-NCalendar -ParameterName Month -ScriptBlock {
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParameter)
Expand Down Expand Up @@ -84,4 +76,4 @@ else {
}

#use this version in verbose output to reflect module version
$modver = (Test-ModuleManifest $PSScriptRoot\PSCalendar.psd1).Version
$modver = (Test-ModuleManifest $PSScriptroot\PSCalendar.psd1).Version
Binary file modified PSCalendarManual.pdf
Binary file not shown.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,16 @@ 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.

## ANSI Support

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.

If you aren't sure if your host supports ANSI, run `Get-PSReadlineOption`. You should see something like this:

![PSReadlineOptions](images/psreadlineoptions.png)

If you don't see color formatting, the hosting application doesn't support ANSI.

## 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:
Expand Down
6 changes: 0 additions & 6 deletions Show-PSCalendarHelp.ps1

This file was deleted.

16 changes: 16 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Change Log for PSCalendar

## v2.8.0

+ 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.
+ 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)
+ Moved `Show-PSCalendarHelp` to a separate file under Functions.
+ Documentation updates.
+ Updated `README.md`.
+ Help updates.

## v2.7.0

+ 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.
+ Restructured module layout.
+ Updated Pester tests.
+ Help updates.

## v2.6.0

+ Updates to `Get-NCalendar` [Issue #25](https://github.com/jdhitsolutions/PSCalendar/issues/25).
Expand Down
52 changes: 43 additions & 9 deletions docs/Get-Calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Displays a visual representation of a calendar.
### month (Default)

```yaml
Get-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-NoANSI] [<CommonParameters>]
Get-Calendar [[-Month] <String>] [[-Year] <Int32>] [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-NoANSI] [-MonthOnly] [<CommonParameters>]
```

### span

```yaml
Get-Calendar -Start <String> -End <String> [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-NoANSI] [<CommonParameters>]
Get-Calendar -Start <String> -End <String> [-HighlightDate <String[]>] [-FirstDay <DayOfWeek>] [-NoANSI] [-MonthOnly] [<CommonParameters>]
```

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

## EXAMPLES

### EXAMPLE 1
### Example 1

```powershell
PS C:\> Get-Calendar
Expand All @@ -52,15 +52,15 @@ PS C:\> Get-Calendar

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

### EXAMPLE 2
### Example 2

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

Display monthly calendars from March to May, 2021.

### EXAMPLE 3
### Example 3

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

Display a month and highlight specific dates in color.

### EXAMPLE 4
### Example 4

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

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.

### EXAMPLE 5
### Example 5

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

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

### Example 6

```powershell
PS C:\> Get-Calendar -Month January -Year 2022 -NoANSI -MonthOnly
January 2022
Sun Mon Tue Wed Thu Fri Sat
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
```

Suppress leading and trailing days from other months with the MonthOnly parameter.

## PARAMETERS

### -Month
Expand Down Expand Up @@ -210,7 +228,23 @@ Accept wildcard characters: False
### -NoANSI
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.
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.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -MonthOnly
Do not show any leading or trailing days from other months.
```yaml
Type: SwitchParameter
Expand All @@ -224,7 +258,7 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
### 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).
Expand Down
4 changes: 3 additions & 1 deletion docs/Get-NCalendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Get-NCalendar [[-Month] <String>] [[-Year] <Int32>] [-HideHighlight] [-Monday] [

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.

If you run this command in the PowerShell ISE, there will be no highlighting or ANSI formatting.

## EXAMPLES

### Example 1
Expand Down Expand Up @@ -119,7 +121,7 @@ Accept wildcard characters: False
### -HideHighlight
Don't highlight the current date.
Don't highlight the current date. This parameter is automatically set to true when running in the PowerShell ISE.
```yaml
Type: SwitchParameter
Expand Down
41 changes: 38 additions & 3 deletions docs/Show-Calendar.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Display a colorized calendar month in the console.
## SYNTAX

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

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

## EXAMPLES

### EXAMPLE 1
### Example 1

```powershell
PS C:\> Show-Calendar
```

Display a colorized version of the current month.

### EXAMPLE 2
### Example 2

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

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

### Example 4

```powershell
PS C:\> Show-Calendar -Month January -Year 2022 -MonthOnly
January 2022
Sun Mon Tue Wed Thu Fri Sat
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
```

Suppress leading and trailing days from other months with the MonthOnly parameter.

## PARAMETERS

### -Month
Expand Down Expand Up @@ -129,7 +147,24 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -MonthOnly
Do not show any leading or trailing days.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
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 5d150f8

Please sign in to comment.