Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions .docs/StrasbourgTransport/Find-CtsStop.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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
ms.date: 08/01/2026
PlatyPS schema version: 2024-05-01
title: Find-CtsStop
---
Expand All @@ -28,21 +28,28 @@ Find-CtsStop [[-Stop] <string[]>] [[-Destination] <string[]>] [-Line <string[]>]

## DESCRIPTION

Queries the cached CTS network data and returns [Stop] objects whose name, line and destination match the given
filters.
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

```pwsh
Find-CtsStop Gallia Gare, Neuhof, Wolfisheim
```

Returns all stops named 'Gallia...' with a line heading towards 'Gare...', 'Neuhof...' or 'Wolfisheim...'

### EXAMPLE 2

```pwsh
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
Expand Down Expand Up @@ -253,7 +260,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

### Stop

Stop objects with the relevant lines and destinations
`Stop` objects with the relevant lines and destinations

## NOTES

Expand Down
18 changes: 11 additions & 7 deletions .docs/StrasbourgTransport/Get-CtsDeparture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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
ms.date: 08/01/2026
PlatyPS schema version: 2024-05-01
title: Get-CtsDeparture
---
Expand Down Expand Up @@ -35,19 +35,23 @@ Get-CtsDeparture -StopObject <Stop[]> [-MaxDepartures <int>] [-WhatIf] [-Confirm

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

```pwsh
Get-CtsDeparture -Stop Gare -Destination Rotterdam
```

### EXAMPLE 2

```pwsh
Find-CtsStop Gare | Get-CtsDeparture -MaxDepartures 5
```

## PARAMETERS

Expand Down Expand Up @@ -203,7 +207,7 @@ HelpMessage: ''

### -StopObject

Stop objects from Find-CtsStop to retrieve departures for
`Stop` objects from `Find-CtsStop` to retrieve departures for

```yaml
Type: Stop[]
Expand Down Expand Up @@ -276,13 +280,13 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

### Stop[]

Stop objects from Find-CtsStop to retrieve departures for
`Stop` objects from `Find-CtsStop` to retrieve departures for

## OUTPUTS

### Departure

Departure objects for the relevant stops
`Departure` objects for the relevant stops

## NOTES

Expand Down
122 changes: 122 additions & 0 deletions .docs/StrasbourgTransport/Set-CtsApiToken.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
document type: cmdlet
external help file: StrasbourgTransport-Help.xml
HelpUri: https://github.com/teanup/cts-pwsh/blob/main/.docs/StrasbourgTransport/Set-CtsApiToken.md#Set-CtsApiToken
Locale: en-US
Module Name: StrasbourgTransport
ms.date: 08/01/2026
PlatyPS schema version: 2024-05-01
title: Set-CtsApiToken
---

# Set-CtsApiToken

## SYNOPSIS

Stores the CTS API token securely in the module directory

## SYNTAX

### __AllParameterSets

```
Set-CtsApiToken [-Token] <string> [-WhatIf] [-Confirm] [<CommonParameters>]
```

## ALIASES

## DESCRIPTION

Saves the given API token in a hidden file (`.cts-api.xml`) in the module directory.

On Windows the token is encrypted with the machine and user keys.

## EXAMPLES

### EXAMPLE 1

```pwsh
Set-CtsApiToken -Token '<your-token>'
```

## 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: ''
```

### -Token

Token to use for authenticating with the CTS API

```yaml
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
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

## NOTES

## RELATED LINKS
13 changes: 9 additions & 4 deletions .docs/StrasbourgTransport/Show-CtsDeparture.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ 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
ms.date: 08/01/2026
PlatyPS schema version: 2024-05-01
title: Show-CtsDeparture
---
Expand Down Expand Up @@ -35,18 +35,23 @@ Show-CtsDeparture -StopObject <Stop[]> [-MaxDepartures <int>] [-RefreshRate <int

## DESCRIPTION

Shows a live-updating table of departures in the terminal (press Ctrl+C to exit).
Shows a live-updating table of departures in the terminal (press <kbd>Ctrl</kbd>+<kbd>C</kbd> to exit).

Refreshes automatically at the given interval and redraws in place using ANSI escape codes.

## EXAMPLES

### EXAMPLE 1

```pwsh
Show-CtsDeparture -Stop Esplanade -Destination Lingolsheim, Robertsau
```

### EXAMPLE 2

```pwsh
Show-CtsDeparture -Stop 'Homme de Fer' -RefreshRate 10
```

## PARAMETERS

Expand Down Expand Up @@ -223,7 +228,7 @@ HelpMessage: ''

### -StopObject

Stop objects from Find-CtsStop to display departures for
`Stop` objects from `Find-CtsStop` to display departures for

```yaml
Type: Stop[]
Expand Down Expand Up @@ -296,7 +301,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable

### Stop[]

Stop objects from Find-CtsStop to retrieve departures for
`Stop` objects from `Find-CtsStop` to retrieve departures for

## OUTPUTS

Expand Down
8 changes: 6 additions & 2 deletions .docs/StrasbourgTransport/StrasbourgTransport.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
document type: module
Help Version: 1.0.1.0
Help Version: 1.1.0.0
HelpInfoUri: ''
Locale: en-US
Module Guid: a3884d25-030d-49e5-957c-139aacb7d2e3
Module Name: StrasbourgTransport
ms.date: 07/28/2026
ms.date: 08/01/2026
PlatyPS schema version: 2024-05-01
title: StrasbourgTransport Module
---
Expand All @@ -26,6 +26,10 @@ Finds CTS stops and lines matching filters

Retrieves the next departures at the specified CTS stops

### [Set-CtsApiToken](Set-CtsApiToken.md)

Stores the CTS API token securely in the module directory

### [Show-CtsDeparture](Show-CtsDeparture.md)

Displays the next departures dynamically at the specified CTS stops
Binary file added .docs/icon-85.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .docs/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .docs/preview-crop.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .docs/preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions .github/workflows/powershell-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish Module
on:
push:
tags:
- "v*.*.*"
- v*.*.*

permissions:
contents: read
Expand All @@ -17,7 +17,9 @@ jobs:

- name: Publish PowerShell module
shell: pwsh
env:
PSGalleryApiKey: ${{ secrets.PSGALLERY_API_KEY }}
run: |
$PublishPath = New-Item -Path ([System.IO.Path]::GetTempPath()) -Name Publish -ItemType Directory
Get-ChildItem -Exclude .* | Copy-Item -Destination $PublishPath -Recurse
Publish-PSResource -Path $PublishPath -ApiKey ${{ secrets.PSGALLERY_API_KEY }} -Repository PSGallery
Get-ChildItem -Exclude .* | Copy-Item -Destination $PublishPath -Recurse -Verbose
Publish-PSResource -Path $PublishPath -ApiKey $env:PSGalleryApiKey -Repository PSGallery -Verbose
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
# CTS API token
*.key

# Automatic NuGet config
NuGet/
.cts-api.xml
4 changes: 2 additions & 2 deletions .script/Set-CtsApiTypes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ if ([String]::IsNullOrEmpty($Path)) {
}

if (-not (Test-Path -Path $Path -PathType Leaf -IsValid)) {
throw "Invalid path for CTS API types: $Path"
Write-Error -Message "Invalid path for CTS API types: $Path" -ErrorAction Stop
}

$OpenApi = Invoke-RestMethod -Uri $OpenApiUrl
$CtsTypes = $OpenApi.components.schemas
if ($null -eq $CtsTypes) {
throw "Invalid OpenAPI format from: $OpenApiUrl"
Write-Error -Message "Invalid OpenAPI format from: $OpenApiUrl" -ErrorAction Stop
}

$null = New-Item -Path $Path -ItemType File -Force -Value @"
Expand Down
3 changes: 2 additions & 1 deletion Classes/CtsCompleter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ class LineCompleter : CtsCompleter {
# Tab completer for the -Destination parameter: returns destination names matching the current context (stop, line)
class DestinationCompleter : CtsCompleter {
hidden [String[]] CtsItems([IDictionary]$FindParam) {
$Destinations = (Find-CtsStop @FindParam).Lines.Destinations
# Destinations must match the word to complete
$Destinations = (Find-CtsStop @FindParam -Strict).Lines.Destinations
return $Destinations | Sort-Object -Unique
}
}
4 changes: 2 additions & 2 deletions Classes/StrasbourgTransport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Line : Formatted {
}

[String] ToString() {
return $this.DisplayName + " `u{279C} " + ($this.Destinations -join ';')
return $this.DisplayName + " `u{279C} " + [String]::Join(';', $this.Destinations)
}
}

Expand Down Expand Up @@ -180,7 +180,7 @@ class Stop {
}

[String] ToString() {
return $this.Name + ' (' + ($this.Lines.Name -join ';') + ')'
return $this.Name + ' (' + [String]::Join(';', $this.Lines.Name) + ')'
}
}

Expand Down
Loading