From 674ed688f08835f4b8adf7d28d06daaa089cfa67 Mon Sep 17 00:00:00 2001 From: peanut Date: Tue, 28 Jul 2026 22:58:42 +0200 Subject: [PATCH 1/2] docs: add online documentation --- .docs/StrasbourgTransport/Find-CtsStop.md | 260 +++++++++++++++ .docs/StrasbourgTransport/Get-CtsDeparture.md | 289 +++++++++++++++++ .../StrasbourgTransport/Show-CtsDeparture.md | 305 ++++++++++++++++++ .../StrasbourgTransport.md | 31 ++ Functions/Public/Find-CtsStop.ps1 | 3 +- Functions/Public/Get-CtsDeparture.ps1 | 3 +- Functions/Public/Show-CtsDeparture.ps1 | 3 +- 7 files changed, 891 insertions(+), 3 deletions(-) create mode 100644 .docs/StrasbourgTransport/Find-CtsStop.md create mode 100644 .docs/StrasbourgTransport/Get-CtsDeparture.md create mode 100644 .docs/StrasbourgTransport/Show-CtsDeparture.md create mode 100644 .docs/StrasbourgTransport/StrasbourgTransport.md diff --git a/.docs/StrasbourgTransport/Find-CtsStop.md b/.docs/StrasbourgTransport/Find-CtsStop.md new file mode 100644 index 0000000..97954ef --- /dev/null +++ b/.docs/StrasbourgTransport/Find-CtsStop.md @@ -0,0 +1,260 @@ +--- +document type: cmdlet +external help file: StrasbourgTransport-Help.xml +HelpUri: https://github.com/teanup/cts-pwsh/blob/main/.docs/StrasbourgTransport/Find-CtsStop.md#Find-CtsStop +Locale: en-US +Module Name: StrasbourgTransport +ms.date: 07/28/2026 +PlatyPS schema version: 2024-05-01 +title: Find-CtsStop +--- + +# Find-CtsStop + +## SYNOPSIS + +Finds CTS stops and lines matching filters + +## SYNTAX + +### __AllParameterSets + +``` +Find-CtsStop [[-Stop] ] [[-Destination] ] [-Line ] [-Strict] [-WhatIf] + [-Confirm] [] +``` + +## ALIASES + +## DESCRIPTION + +Queries the cached CTS network data and returns [Stop] objects whose name, line and destination match the given +filters. +Stop, line and destination names are matched by prefix (case-insensitive), so partial names work. + +## EXAMPLES + +### EXAMPLE 1 + +Find-CtsStop Gallia Gare, Neuhof, Wolfisheim +Returns all stops named 'Gallia...' with a line heading towards 'Gare...', 'Neuhof...' or 'Wolfisheim...' + +### EXAMPLE 2 + +Find-CtsStop -Line A, D -Destination Kehl, Illkirch -Strict +Returns all stops for lines 'A' and 'D' with the only destinations 'Kehl...' and 'Illkirch...' +Destinations with the same direction are excluded: 'Port du Rhin', 'Les Halles' + +## PARAMETERS + +### -Completion + +Enable loose prefix matching for argument completion (internal) + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: '' +SupportsWildcards: false +Aliases: +- cf +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Destination + +Destination names to filter by (prefix match) + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: +- To +ParameterSets: +- Name: (All) + Position: 1 + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Force + +Bypass the stop cache and fetch fresh data from the API + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Line + +Line names to filter by + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -NoCacheFile + +Skip writing the cache file to disk + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Stop + +Stop names to filter by (prefix match) + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: +- From +ParameterSets: +- Name: (All) + Position: 0 + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Strict + +Only return destinations that exactly match -Destination, excluding same-direction alternatives + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -WhatIf + +Runs the command in a mode that only reports what would happen without performing the actions. + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: '' +SupportsWildcards: false +Aliases: +- wi +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, +-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Stop + +Stop objects with the relevant lines and destinations + +## NOTES + +## RELATED LINKS diff --git a/.docs/StrasbourgTransport/Get-CtsDeparture.md b/.docs/StrasbourgTransport/Get-CtsDeparture.md new file mode 100644 index 0000000..b074fea --- /dev/null +++ b/.docs/StrasbourgTransport/Get-CtsDeparture.md @@ -0,0 +1,289 @@ +--- +document type: cmdlet +external help file: StrasbourgTransport-Help.xml +HelpUri: https://github.com/teanup/cts-pwsh/blob/main/.docs/StrasbourgTransport/Get-CtsDeparture.md#Get-CtsDeparture +Locale: en-US +Module Name: StrasbourgTransport +ms.date: 07/28/2026 +PlatyPS schema version: 2024-05-01 +title: Get-CtsDeparture +--- + +# Get-CtsDeparture + +## SYNOPSIS + +Retrieves the next departures at the specified CTS stops + +## SYNTAX + +### Filters (Default) + +``` +Get-CtsDeparture [[-Stop] ] [[-Destination] ] [-Line ] [-Strict] + [-MaxDepartures ] [-WhatIf] [-Confirm] [] +``` + +### Object + +``` +Get-CtsDeparture -StopObject [-MaxDepartures ] [-WhatIf] [-Confirm] + [] +``` + +## ALIASES + +## DESCRIPTION + +Returns [Departure] objects with the upcoming departure times for the stops, lines and destinations matching +the given filters. +Accepts filter parameters or piped [Stop] objects from Find-CtsStop. + +## EXAMPLES + +### EXAMPLE 1 + +Get-CtsDeparture -Stop Gare -Destination Rotterdam + +### EXAMPLE 2 + +Find-CtsStop Gare | Get-CtsDeparture -MaxDepartures 5 + +## PARAMETERS + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: '' +SupportsWildcards: false +Aliases: +- cf +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Destination + +Destination names to filter by (prefix match) + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: +- To +ParameterSets: +- Name: Filters + Position: 1 + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Force + +Bypass the stop and departure caches + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Line + +Line names to filter by + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: Filters + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -MaxDepartures + +Maximum number of departure times to return per line, stop and destination + +```yaml +Type: System.Int32 +DefaultValue: 3 +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -NoCacheFile + +Skip writing the cache file to disk + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: Filters + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Stop + +Stop names to filter by (prefix match) + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: +- From +ParameterSets: +- Name: Filters + Position: 0 + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -StopObject + +Stop objects from Find-CtsStop to retrieve departures for + +```yaml +Type: Stop[] +DefaultValue: '' +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: Object + Position: Named + IsRequired: true + ValueFromPipeline: true + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Strict + +Only return destinations that exactly match -Destination, excluding same-direction alternatives + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: Filters + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -WhatIf + +Runs the command in a mode that only reports what would happen without performing the actions. + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: '' +SupportsWildcards: false +Aliases: +- wi +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, +-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Stop[] + +Stop objects from Find-CtsStop to retrieve departures for + +## OUTPUTS + +### Departure + +Departure objects for the relevant stops + +## NOTES + +## RELATED LINKS diff --git a/.docs/StrasbourgTransport/Show-CtsDeparture.md b/.docs/StrasbourgTransport/Show-CtsDeparture.md new file mode 100644 index 0000000..39c78d3 --- /dev/null +++ b/.docs/StrasbourgTransport/Show-CtsDeparture.md @@ -0,0 +1,305 @@ +--- +document type: cmdlet +external help file: StrasbourgTransport-Help.xml +HelpUri: https://github.com/teanup/cts-pwsh/blob/main/.docs/StrasbourgTransport/Show-CtsDeparture.md#Show-CtsDeparture +Locale: en-US +Module Name: StrasbourgTransport +ms.date: 07/28/2026 +PlatyPS schema version: 2024-05-01 +title: Show-CtsDeparture +--- + +# Show-CtsDeparture + +## SYNOPSIS + +Displays the next departures dynamically at the specified CTS stops + +## SYNTAX + +### Filters (Default) + +``` +Show-CtsDeparture [[-Stop] ] [[-Destination] ] [-Line ] [-Strict] + [-MaxDepartures ] [-RefreshRate ] [-WhatIf] [-Confirm] [] +``` + +### Object + +``` +Show-CtsDeparture -StopObject [-MaxDepartures ] [-RefreshRate ] [-WhatIf] + [-Confirm] [] +``` + +## ALIASES + +## DESCRIPTION + +Shows a live-updating table of departures in the terminal (press Ctrl+C to exit). +Refreshes automatically at the given interval and redraws in place using ANSI escape codes. + +## EXAMPLES + +### EXAMPLE 1 + +Show-CtsDeparture -Stop Esplanade -Destination Lingolsheim, Robertsau + +### EXAMPLE 2 + +Show-CtsDeparture -Stop 'Homme de Fer' -RefreshRate 10 + +## PARAMETERS + +### -Confirm + +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: '' +SupportsWildcards: false +Aliases: +- cf +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Destination + +Destination names to filter by (prefix match) + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: +- To +ParameterSets: +- Name: Filters + Position: 1 + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Force + +Bypass the stop and departure caches + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Line + +Line names to filter by + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: Filters + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -MaxDepartures + +Maximum number of departure times to show per line, stop and destination + +```yaml +Type: System.Int32 +DefaultValue: 3 +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -NoCacheFile + +Skip writing the cache file to disk + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: Filters + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -RefreshRate + +Time between each departure refresh in seconds + +```yaml +Type: System.Int32 +DefaultValue: 5 +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Stop + +Stop names to filter by (prefix match) + +```yaml +Type: System.String[] +DefaultValue: '' +SupportsWildcards: false +Aliases: +- From +ParameterSets: +- Name: Filters + Position: 0 + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -StopObject + +Stop objects from Find-CtsStop to display departures for + +```yaml +Type: Stop[] +DefaultValue: '' +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: Object + Position: Named + IsRequired: true + ValueFromPipeline: true + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -Strict + +Only return destinations that exactly match -Destination, excluding same-direction alternatives + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: False +SupportsWildcards: false +Aliases: [] +ParameterSets: +- Name: Filters + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### -WhatIf + +Runs the command in a mode that only reports what would happen without performing the actions. + +```yaml +Type: System.Management.Automation.SwitchParameter +DefaultValue: '' +SupportsWildcards: false +Aliases: +- wi +ParameterSets: +- Name: (All) + Position: Named + IsRequired: false + ValueFromPipeline: false + ValueFromPipelineByPropertyName: false + ValueFromRemainingArguments: false +DontShow: false +AcceptedValues: [] +HelpMessage: '' +``` + +### CommonParameters + +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, +-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, +-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see +[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Stop[] + +Stop objects from Find-CtsStop to retrieve departures for + +## OUTPUTS + +## NOTES + +## RELATED LINKS diff --git a/.docs/StrasbourgTransport/StrasbourgTransport.md b/.docs/StrasbourgTransport/StrasbourgTransport.md new file mode 100644 index 0000000..6fb4706 --- /dev/null +++ b/.docs/StrasbourgTransport/StrasbourgTransport.md @@ -0,0 +1,31 @@ +--- +document type: module +Help Version: 1.0.1.0 +HelpInfoUri: '' +Locale: en-US +Module Guid: a3884d25-030d-49e5-957c-139aacb7d2e3 +Module Name: StrasbourgTransport +ms.date: 07/28/2026 +PlatyPS schema version: 2024-05-01 +title: StrasbourgTransport Module +--- + +# StrasbourgTransport Module + +## Description + +Display Strasbourg public transport departures in PowerShell + +## StrasbourgTransport Cmdlets + +### [Find-CtsStop](Find-CtsStop.md) + +Finds CTS stops and lines matching filters + +### [Get-CtsDeparture](Get-CtsDeparture.md) + +Retrieves the next departures at the specified CTS stops + +### [Show-CtsDeparture](Show-CtsDeparture.md) + +Displays the next departures dynamically at the specified CTS stops diff --git a/Functions/Public/Find-CtsStop.ps1 b/Functions/Public/Find-CtsStop.ps1 index 48d7833..e871044 100644 --- a/Functions/Public/Find-CtsStop.ps1 +++ b/Functions/Public/Find-CtsStop.ps1 @@ -15,7 +15,8 @@ function Find-CtsStop { .OUTPUTS [Stop] objects with the relevant lines and destinations #> - [CmdletBinding(SupportsShouldProcess)] + [CmdletBinding(SupportsShouldProcess, + HelpUri = 'https://github.com/teanup/cts-pwsh/blob/main/.docs/StrasbourgTransport/Find-CtsStop.md#Find-CtsStop')] [OutputType([Stop])] param ( # Line names to filter by diff --git a/Functions/Public/Get-CtsDeparture.ps1 b/Functions/Public/Get-CtsDeparture.ps1 index 669a95a..f591ac1 100644 --- a/Functions/Public/Get-CtsDeparture.ps1 +++ b/Functions/Public/Get-CtsDeparture.ps1 @@ -12,7 +12,8 @@ function Get-CtsDeparture { .OUTPUTS [Departure] objects for the relevant stops, lines and destinations #> - [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Filters')] + [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Filters', + HelpUri = 'https://github.com/teanup/cts-pwsh/blob/main/.docs/StrasbourgTransport/Get-CtsDeparture.md#Get-CtsDeparture')] [OutputType([Departure])] param ( # Line names to filter by diff --git a/Functions/Public/Show-CtsDeparture.ps1 b/Functions/Public/Show-CtsDeparture.ps1 index 1a1bafb..44bfe71 100644 --- a/Functions/Public/Show-CtsDeparture.ps1 +++ b/Functions/Public/Show-CtsDeparture.ps1 @@ -10,7 +10,8 @@ function Show-CtsDeparture { .EXAMPLE Show-CtsDeparture -Stop 'Homme de Fer' -RefreshRate 10 #> - [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Filters')] + [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = 'Filters', + HelpUri = 'https://github.com/teanup/cts-pwsh/blob/main/.docs/StrasbourgTransport/Show-CtsDeparture.md#Show-CtsDeparture')] [OutputType([Void])] param ( # Line names to filter by From bceffba955f20adbef2dc3342eac521b6213e7fd Mon Sep 17 00:00:00 2001 From: peanut Date: Tue, 28 Jul 2026 23:03:46 +0200 Subject: [PATCH 2/2] fix: arg completions with quotes, syntax error --- Classes/CtsCompleter.ps1 | 7 +++---- Functions/Private/Update-CtsStopCache.ps1 | 2 +- README.md | 19 ++++++++++++++++--- StrasbourgTransport.psd1 | 6 ++++-- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Classes/CtsCompleter.ps1 b/Classes/CtsCompleter.ps1 index 01d45f1..e2d5605 100644 --- a/Classes/CtsCompleter.ps1 +++ b/Classes/CtsCompleter.ps1 @@ -1,8 +1,6 @@ <# .SYNOPSIS Argument completers for CTS stops, lines and destinations -.LINK -https://gist.github.com/santisq/ad07e2e3913de981c4d2e06f41e6ddb4#file-thing-doesnt-work-with-scriptblock-ps1 #> using namespace System.Management.Automation @@ -12,6 +10,7 @@ using namespace System.Collections.Generic # Base argument completer that delegates item lookup to a CtsItems method class CtsCompleter : IArgumentCompleter { + # Based on: https://gist.github.com/santisq/ad07e2e3913de981c4d2e06f41e6ddb4 hidden [List[CompletionResult]] $Results = [List[CompletionResult]]::new() [IEnumerable[CompletionResult]] CompleteArgument( @@ -30,13 +29,13 @@ class CtsCompleter : IArgumentCompleter { Completion = $true } # Unescape quotes for CTS item lookup - $FindParam.$ParameterName = [Regex]::Unescape($WordToComplete -replace '(^"|"$)|(^''|''$)') + $FindParam.$ParameterName = [Regex]::Unescape($WordToComplete -replace '^"|"$|^''|''$') $CompletionItems = $this.CtsItems($FindParam) foreach ($Item in $CompletionItems) { # Escape quotes for command line parameter text $Completion = [CodeGeneration]::EscapeSingleQuotedStringContent($Item) - if ($Item -match '\s') { + if ($Item -match '\s|''|"') { $Completion = "'$Completion'" } diff --git a/Functions/Private/Update-CtsStopCache.ps1 b/Functions/Private/Update-CtsStopCache.ps1 index 7352753..da1371e 100644 --- a/Functions/Private/Update-CtsStopCache.ps1 +++ b/Functions/Private/Update-CtsStopCache.ps1 @@ -138,7 +138,7 @@ function Update-CtsStopCache { $FileCache.Lines | ForEach-Object { $_.Destinations = [StopCache]::Instance.Destinations[$_.Id] } $SetParam = @{ Path = $FileCachePath - Force = true + Force = $true WhatIf = $false Confirm = $false } diff --git a/README.md b/README.md index 2311288..0131d96 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,22 @@ # StrasbourgTransport (PowerShell module) +[![PowerShell Gallery Version](https://img.shields.io/powershellgallery/v/StrasbourgTransport.svg?label=PowerShell%20Gallery&style=flat-square)](https://www.powershellgallery.com/packages/StrasbourgTransport) +[![PowerShell Gallery Downloads](https://img.shields.io/powershellgallery/dt/StrasbourgTransport.svg?label=Downloads&style=flat-square)](https://www.powershellgallery.com/stats/packages/StrasbourgTransport?groupby=Version) +[![Code Quality Workflow Status](https://img.shields.io/github/actions/workflow/status/teanup/cts-pwsh/powershell-quality.yml?label=Code%20Quality&style=flat-square)](https://github.com/teanup/cts-pwsh/actions/workflows/powershell-quality.yml) +[![Publish Module Workflow Status](https://img.shields.io/github/actions/workflow/status/teanup/cts-pwsh/powershell-publish.yml?label=Publish%20Module&style=flat-square)](https://github.com/teanup/cts-pwsh/actions/workflows/powershell-publish.yml) + Display Strasbourg public transport departures in PowerShell. ## Prerequisites +### Install module + +```pwsh +Install-PSResource -Name StrasbourgTransport +``` + +### CTS API token + You need a **CTS API token** to use this module. 1. Request an account on the [CTS Open Data portal](https://cts-strasbourg.eu/en/open-data/) @@ -33,7 +46,7 @@ Find-CtsStop -Line A, D -Destination Kehl, Illkirch Find-CtsStop -Line A, D -Destination Kehl, Illkirch -Strict ``` -Returns `[Stop]` objects that can be piped into `Get-CtsDeparture` or `Show-CtsDeparture`. +Returns `Stop` objects that can be piped into `Get-CtsDeparture` or `Show-CtsDeparture`. ### Get-CtsDeparture @@ -47,7 +60,7 @@ Get-CtsDeparture Gare Rotterdam Find-CtsStop Esplanade | Get-CtsDeparture -MaxDepartures 5 ``` -Returns `[Departure]` objects with the stop name, line info and departure times. +Returns `Departure` objects with the stop name, line info and departure times. ### Show-CtsDeparture @@ -61,4 +74,4 @@ Show-CtsDeparture -Stop 'Homme de Fer' -RefreshRate 10 Find-CtsStop -Line H -Destination Parlement | Show-CtsDeparture ``` -The display refreshes automatically at the given interval and redraws in place using ANSI escape codes. Live (real-time) departure times are shown in **bold**; scheduled times are shown with an underline. +The display refreshes automatically at the given interval and redraws in place using ANSI escape codes. Live (real-time) departure times are shown in **bold**, scheduled times are shown with an underline. diff --git a/StrasbourgTransport.psd1 b/StrasbourgTransport.psd1 index cdee1b2..1554d38 100644 --- a/StrasbourgTransport.psd1 +++ b/StrasbourgTransport.psd1 @@ -8,7 +8,7 @@ RootModule = 'StrasbourgTransport.psm1' # Version number of this module. - ModuleVersion = '1.0.0' + ModuleVersion = '1.0.1' # Supported PSEditions # CompatiblePSEditions = @() @@ -116,6 +116,8 @@ ReleaseNotes = @' 1.0.0 - Initial release: CTS stop lookup, dynamic departure display + 1.0.1 + - Fix: add missing online help, fix minor issues '@ # Prerelease string of this module @@ -132,7 +134,7 @@ } # End of PrivateData hashtable # HelpInfo URI of this module - HelpInfoURI = 'https://github.com/teanup/cts-pwsh?tab=readme-ov-file' + # HelpInfoURI = '' # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. # DefaultCommandPrefix = ''