Skip to content

Add #Requires -PSEdition Core directive to Install-NerdFont #62

Description

The module targets PowerShell Core and uses syntax not supported by Windows PowerShell 5.1, such as the clean block. When a user attempts to import the module on Windows PowerShell, the error message is cryptic and unhelpful — a parse error about a missing closing } rather than a clear statement about edition incompatibility (as seen in #36).

Request

Desired capability

Adding #Requires -PSEdition Core to Install-NerdFont.ps1 would cause PowerShell to emit a clear, descriptive error when the function is loaded on an unsupported edition. This moves the guidance from documentation into the runtime shell itself, making the incompatibility self-documenting.

The #Requires -PSEdition directive is the idiomatic way to declare edition requirements in PowerShell.

Acceptance criteria

  • #Requires -PSEdition Core is present in Install-NerdFont.ps1
  • Running Import-Module NerdFonts on Windows PowerShell 5.1 produces a clear error indicating PowerShell Core is required, instead of a parse error
  • No change in behavior on PowerShell 7+

Related


Technical decisions

Directive placement: Add #Requires -PSEdition Core at the top of src/functions/public/Install-NerdFont.ps1, alongside the existing #Requires -Modules directives.

Scope: Only Install-NerdFont.ps1 uses syntax (clean block) that is incompatible with Windows PowerShell 5.1. Other public functions may not need this directive, but should be evaluated.


Implementation plan

  • Add #Requires -PSEdition Core to the top of src/functions/public/Install-NerdFont.ps1
  • Evaluate whether Get-NerdFont.ps1 and completers.ps1 also need the directive
  • Verify that importing the module on PowerShell 7+ still works correctly

Activity

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions