Skip to content

State That a PowerShell Script Answers -Help and -h Rather Than a Literal --help #3602

Closed

Description

@ptr727

Problem

CODESTYLE.md "Command-Line Arguments" says every command-line script "answers --help and -h", and that "PowerShell's own refusal of a parameter it cannot bind counts" for an unknown argument. A PowerShell script that declares a -Help switch with an h alias, as the hub's own host-setup/windows scripts do, answers -h and -Help. A literal --help binds to nothing, though, so PowerShell refuses it with its binding error instead of printing the help.

So a carrier reading the rule literally finds every PowerShell script in breach, while the hub's own scripts take that form deliberately.

Decision Already Taken

ptr727/HomeAutomation-Config#1467 put the question to the maintainer, who chose to keep the PowerShell form: -Help and -h answer, a literal --help is refused by the binder like any other unbound argument, and no script changes. A PowerShell user types -Help or Get-Help, and the binder's refusal already names the argument.

Change

State that in the rule text, for example by saying that a PowerShell script answers -Help and -h, and that its binder refusing --help meets the unknown-argument bullet. That keeps the rule and the hub's scripts in agreement for every carrier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions