Repository navigation
Start XKCD
Opens a full-screen terminal interface for browsing XKCD comics -- a TUI parody of https://xkcd.com/.
Start-XKCD [[-Number] <Int32>] [-HighQuality] [-StatePath <String>] [-Offline] [-CachePath <String>]
[-DownloadPath <String>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
Start-XKCD [-Random] [-Minimum <Int32>] [-Maximum <Int32>] [-HighQuality] [-StatePath <String>] [-Offline]
[-CachePath <String>] [-DownloadPath <String>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
[<CommonParameters>]
Start-XKCD [-Resume] [-HighQuality] [-StatePath <String>] [-Offline] [-CachePath <String>]
[-DownloadPath <String>] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
The Start-XKCD cmdlet opens an interactive, full-screen view of a comic (its title, image, and alt text, framed by an ASCII art "xkcd" banner, with a control bar shown both above and below the image) and lets you browse the archive without leaving it:
- G prompts for a comic number to jump straight to.
- F displays the first comic (#1).
- P or the left arrow displays the previous comic (does nothing at comic #1). Shift+Left jumps back 10 comics at a time instead (clamped to comic #1).
- R displays a random comic from the full archive.
- N or the right arrow displays the next comic (does nothing once you reach the latest comic). Shift+Right jumps ahead 10 comics at a time instead (clamped to the latest comic).
- L displays the latest comic.
- Q or Escape exits back to your normal console.
The image is only rendered if your terminal supports the Sixel, Kitty, or iTerm2 inline image graphics protocol; otherwise you'll still see the rest and can keep browsing. As with Show-XKCD, each comic you view updates the local state file also used by Get-XKCD/Show-XKCD's -Next/-Previous and by Test-XKCD, so stepping out of Start-XKCD leaves you exactly where Show-XKCD -Next would pick back up.
By default, Start-XKCD opens on the latest available comic. Use -Number to open on a specific comic instead (accepts pipeline input, e.g. from Get-XKCD), -Random to open on a random comic -- optionally bounded by -Minimum/-Maximum (aliased -Min/-Max) -- or -Resume to open on whichever comic you last read, as recorded in the state file (falls back to the latest comic if the state file has no record yet).
Use -Offline to browse using data from the local cache (created/refreshed by Update-XKCDCache) and images previously saved with Get-XKCD -Download, instead of fetching either from the xkcd API -- this also governs which comic counts as "latest" for the default starting comic, the right arrow boundary, and R. If a comic's image hasn't been downloaded to -DownloadPath yet, a warning is shown and that comic's frame is displayed without an image, rather than stopping you from continuing to browse. Defaults to the value saved with Set-XKCDDefault -Offline, if any.
Start-XKCD
Opens the interactive viewer on the latest comic.
Start-XKCD 2000
Opens the interactive viewer on comic number 2000.
Start-XKCD -Random
Opens the interactive viewer on a random comic from the full archive.
Start-XKCD -Random -Minimum 100 -Maximum 150
Opens the interactive viewer on a random comic numbered between 100 and 150.
Get-XKCD -Random | Start-XKCD
Opens the interactive viewer on a random comic retrieved via Get-XKCD, passed in via the pipeline.
Start-XKCD -HighQuality
Opens the interactive viewer, rendering the higher resolution (_2x) version of each comic's image where available.
Start-XKCD -Offline
Opens the interactive viewer using the local cache and previously downloaded images, instead of fetching either from the xkcd API.
Start-XKCD -Resume
Opens the interactive viewer on whichever comic you last read, as recorded in the state file.
Opens the interactive viewer on the specified comic. By default it opens on the latest comic. Accepts pipeline input, e.g. from Get-XKCD.
Type: Int32
Parameter Sets: Specific
Aliases: Num
Required: False
Position: 1
Default value: 0
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: FalseOpens the interactive viewer on a random comic from the full archive, optionally bounded by -Minimum/-Maximum.
Type: SwitchParameter
Parameter Sets: Random
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseOpens the interactive viewer on whichever comic you last read, as recorded in the state file (the same record used by Get-XKCD/Show-XKCD's -Next/-Previous and by Test-XKCD). Falls back to the latest comic if the state file has no record yet.
Type: SwitchParameter
Parameter Sets: Resume
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseUse with -Random to define a lower bound within which to pick a comic. Defaults to 1.
Type: Int32
Parameter Sets: Random
Aliases: Min
Required: False
Position: Named
Default value: 1
Accept pipeline input: False
Accept wildcard characters: FalseUse with -Random to define an upper bound within which to pick a comic. Defaults to the latest comic number (or the latest cached comic number, with -Offline).
Type: Int32
Parameter Sets: Random
Aliases: Max
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: FalseRenders the higher resolution (_2x) version of each comic's image, where available. Comics that do not have a higher resolution version are rendered at the standard quality instead. Defaults to the value saved with Set-XKCDDefault -HighQuality, if any.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-XKCDDefaultValue -Name 'HighQuality' -Value $false)
Accept pipeline input: False
Accept wildcard characters: FalsePath to the file used to track the number of the most recently viewed comic (used by Test-XKCD and by Get-XKCD/Show-XKCD's -Next/-Previous). By default this is in the user's per-user data directory (~/.xkcd), unless a default has been saved with Set-XKCDDefault -StatePath.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-XKCDDefaultValue -Name 'StatePath' -Value (Get-XKCDUserDataPath -FileName 'XKCD.state.json' -LegacyDirectory $PSScriptRoot))
Accept pipeline input: False
Accept wildcard characters: FalseBrowses comic data from the local cache, and renders each comic's image from a copy previously saved with Get-XKCD -Download, instead of fetching either from the xkcd API. Shows a warning and displays the comic without an image if it hasn't been downloaded to -DownloadPath yet. Defaults to the value saved with Set-XKCDDefault -Offline, if any.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-XKCDDefaultValue -Name 'Offline' -Value $false)
Accept pipeline input: False
Accept wildcard characters: FalseUse with -Offline to specify where comic data is cached. By default this is within the module path, unless a default has been saved with Set-XKCDDefault -CachePath.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-XKCDDefaultValue -Name 'CachePath' -Value (Join-Path $PSScriptRoot 'XKCD.json'))
Accept pipeline input: False
Accept wildcard characters: FalseUse with -Offline to specify the local directory to look for previously downloaded comic images in (as saved by Get-XKCD -Download). By default this is the current working directory, unless a default has been saved with Set-XKCDDefault -Path.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: (Get-XKCDDefaultValue -Name 'Path' -Value $PWD)
Accept pipeline input: False
Accept wildcard characters: FalseShows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalsePrompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False{{Fill ProgressAction Description}}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis 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).
https://github.com/markwragg/Powershell-XKCD/wiki/Start-XKCD