Add -Previous switch to retrieve last shown tip
Feature: Add -Previous switch to Write-PowerShellTip cmdlet
Summary:
Implemented the feature request to add a -Previous switch to Write-PowerShellTip and Get-PowerShellTip cmdlets that allows users to display the last shown tip instead of showing a new tip. The tip is not marked as shown again when using this parameter.
Changes:
- Added
GetLastShownTipIdhelper function to retrieve the last shown tip ID - Added
-Previousparameter toGet-PowerShellTipcmdlet - Added
-Previousparameter toWrite-PowerShellTipcmdlet - Added comprehensive tests (8 new test cases)
- All 111 tests passing
- Linter (PSScriptAnalyzer) passing
Notes:
- Reverted unrelated PowerShellTips.json changes (line endings were normalized by build script)
- Code review feedback addressed: removed redundant
Mandatory = $falsefrom switch parameters
Original prompt
This section details on the original issue you should resolve
<issue_title>Feature Request: Add "Write-PowerShellTip -Previous" switch to output the last shown tip</issue_title> <issue_description>The PowerShell tips shown are already stored in a file in the module configuration. It would be great if we could use a
-Previousswitch on theWrite-PowerShellTipcmdlet to show the last tip that was shown, instead of showing the next tip. We would want to make sure that when we show the "previous" tip, that it does not write the same tip ID to "tips shown" file again.</issue_description><agent_instructions>Follow the same coding conventions used in the other code files</agent_instructions>
Comments on the Issue (you are @copilot in this section)
- Fixes deadlydog/PowerShell.tiPS#147
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.