Skip to content

Give the script a generated reference, a hero and CI - #1

Merged
simon-vedder merged 1 commit into
mainfrom
docs/command-reference
Sep 8, 2026
Merged

simon-vedder merged 1 commit into
mainfrom
docs/command-reference

Conversation

@simon-vedder

Copy link
Copy Markdown
Owner

The script had no documented parameters anywhere. Readers had to open a 1300-line file to find out what -InactiveDays does. It now has a reference generated from its own comment-based help — the same approach the module-shaped tools use — so the published parameter table cannot drift from the script people download.

Two real bugs in the help

  • Both .EXAMPLE blocks named Get-AppLifecycleAnalysis.ps1, a file that does not exist. Anyone copying them got "file not found".
  • .NOTES carried Author/Site/License bookkeeping and .DESCRIPTION a nested bullet list. Neither survives being rendered as a page.

The help is now prose that reads the same in the terminal and on the web, with four examples that run as written.

Two found by pointing the analyzer at the file

  • The catch around federated credentials was empty, so an app that refused to hand them over showed as having none. On an audit that is a wrong answer rather than a missing one — failures are counted and warned about now.
  • Added #Requires -Version 7.0. The script already used $IsWindows, so it was PowerShell 7 only in fact; now it says so instead of failing strangely.

CI

PSScriptAnalyzer plus New-CommandReference.ps1 -Check, which is what stops the reference drifting. The settings follow the two-space convention this script is written in rather than importing another repository's, and exclude two rules with the reason written next to them:

  • PSAvoidUsingWriteHost — this is an interactive console script; the progress is for a person.
  • PSUseBOMForUnicodeEncodedFile — the BOM exists for Windows PowerShell 5.1, which #Requires -Version 7.0 already rules out.

Verified locally: PSScriptAnalyzer: clean, -Check passes, Get-Help still resolves the synopsis and all six parameters with #Requires above the help block.

The hero renders from docs/images/hero.source.html; the tools site gets a copy in the companion PR.

The script had no documented parameters anywhere: readers had to open a 1300-line
file to find out what -InactiveDays does. It now has a reference generated from
its own comment-based help, the same way the module-shaped tools do it, so the
published parameter table cannot drift from the script people download.

Two real bugs in the help, found while generating from it:

  - both examples named Get-AppLifecycleAnalysis.ps1, a file that does not exist
  - the .NOTES block carried Author/Site/License bookkeeping and the description
    a nested bullet list, neither of which survives being rendered as a page

The help is now prose that reads the same in the terminal and on the web, with
four examples that run as written.

Also fixed while the analyzer was pointed at the file:

  - the catch around federated credentials was empty, so an app that refused to
    hand them over showed as having none. On an audit that is a wrong answer
    rather than a missing one; failures are counted and warned about now.
  - added #Requires -Version 7.0. The script already used $IsWindows, so it was
    PowerShell 7 only in fact; now it says so instead of failing strangely.

CI runs PSScriptAnalyzer and checks that the reference is current. The analyzer
settings follow the two-space convention the script is written in rather than
importing another repository's, and exclude two rules with the reason in place.
@simon-vedder
simon-vedder merged commit 90a5659 into main Sep 8, 2026
1 check passed
@simon-vedder
simon-vedder deleted the docs/command-reference branch September 8, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant