Add AllTipsShownBehaviours to control tip display behavior when all tips have been shown
Adds a new AllTipsShownBehaviours enum that allows users to configure what happens when all tips have been shown - either clear the shown tips list and continue cycling, or stop showing tips automatically.
Changes
C# Enums and Configuration
- Created new
AllTipsShownBehavioursenum inConfiguration.cswith values:-
ClearShownTipsList = 0(default) - Clears the shown tips list and continues showing all tips in rotation -
DoNotShowTips = 1- Stops showing tips automatically when all tips have been shown
-
- Added
AllTipsShownBehaviourproperty to theConfigurationclass
PowerShell Logic
- Added
TestIfUnseenTipsExistfunction that compares all tip IDs againstTipIdsAlreadyShown.txt - Updated
WriteAutomaticPowerShellTipIfNeededto checkAllTipsShownBehaviourafter cadence evaluation - Added
AllTipsShownBehaviourparameter toSet-TiPSConfigurationwith updated help text and examples
Documentation
- Updated ReadMe.md with a new "Show only unseen tips" subsection under "🤖 Automatic tip on PowerShell startup"
- Added example showing how to configure the
DoNotShowTipsoption - Documented available parameter values and behavior
Tests
- Added tests for
DoNotShowTipsoption behavior (shows tip when unseen tips exist, skips when all shown) - Added tests for
TestIfUnseenTipsExisthelper function
Design
This approach separates two orthogonal concerns:
- Cadence (Never, EverySession, Daily, Weekly, Biweekly, Monthly) controls when to show tips
- Behaviour (ClearShownTipsList, DoNotShowTips) controls what happens when all tips have been shown
This allows users to combine any cadence with the all-tips-shown behavior for maximum flexibility.
Usage
# Show tips daily, but stop showing them when all tips have been shown
Set-TiPSConfiguration -AutomaticallyWritePowerShellTip Daily -AllTipsShownBehaviour DoNotShowTips
# Show tips every session, clearing the shown tips list when all have been shown (default behavior)
Set-TiPSConfiguration -AutomaticallyWritePowerShellTip EverySession -AllTipsShownBehaviour ClearShownTipsList
- Fixes deadlydog/PowerShell.tiPS#152
Original prompt
This section details on the original issue you should resolve
<issue_title>Feature Request: Only display tip automatically when there is an unseen tip</issue_title> <issue_description>We currently track all of the tips that have been shown in the
TipIdsAlreadyShown.txtfile. We want to add a new 'NewTipsOnlyvalue to theWritePowerShellTipCadenceenum, and when configured to use this setting, have the module only automatically display a tip if it is not already in theTipIdsAlreadyShown.txt` file.</issue_description>Comments on the Issue (you are @copilot in this section)
- Fixes deadlydog/PowerShell.tiPS#152
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
| Overall Project | 91.35% | :green_apple: |
|---|
There is no coverage information present for the Files changed
| Overall Project | 91.35% | :green_apple: |
|---|
There is no coverage information present for the Files changed
@copilot Also update the ReadMe.md to show an example of setting the AutoWritePowerShellTipOptions to OnlyShowUnseenTips.
| Overall Project | 91.21% | :green_apple: |
|---|
There is no coverage information present for the Files changed
| Overall Project | 91.21% | :green_apple: |
|---|
There is no coverage information present for the Files changed
@copilot Also update the ReadMe.md to show an example of setting the AutoWritePowerShellTipOptions to OnlyShowUnseenTips.
Added in commit 3a7dbf2.
Created a new subsection "Show only unseen tips" under the "🤖 Automatic tip on PowerShell startup" section with an example showing how to use the OnlyWriteUnseenTips option:
Set-TiPSConfiguration -AutomaticallyWritePowerShellTip Daily -AutomaticallyWritePowerShellTipOption OnlyWriteUnseenTips
The section also explains the available values and behavior of the option.
| Overall Project | 91.21% | :green_apple: |
|---|
There is no coverage information present for the Files changed
| Overall Project | 91.21% | :green_apple: |
|---|
There is no coverage information present for the Files changed
| Overall Project | 91.21% | :green_apple: |
|---|
There is no coverage information present for the Files changed
| Overall Project | 91.21% | :green_apple: |
|---|
There is no coverage information present for the Files changed