When a user re-runs Install-NerdFont -Name 'FiraCode' (for example after rerunning a setup script, or with -All on a partially-installed system), the function downloads and extracts the archive even if the font is already present. The actual install step inside Install-Font is a no-op without -Force, but the bandwidth and disk I/O leading up to it are spent regardless.
Request
Current experience
Re-running the command on a system where the font is already installed still downloads tens of megabytes per font and extracts each archive. The end state is unchanged.
Desired experience
When the font is already installed at the requested scope and -Force is not specified, Install-NerdFont skips the download and extraction phases entirely for that font and emits a clear verbose message ("already installed, skipping"). With -Force the current behavior is preserved.
Acceptance criteria
- A font that is already installed at the requested scope is skipped end-to-end (no download, no extract, no install) when
-Force is not used
-Force continues to overwrite/reinstall as today
- The skip is logged at verbose level so users can see why no work happened
- Bulk runs (
-All) only download archives for fonts that actually need installing
Related
Get-Font — used to detect existing installations
Technical decisions
Detection: Use Get-Font -Scope $Scope once at the start of process to build a HashSet[string] of installed font family names. Match each candidate Nerd Font's name against the set with a single wildcard (<Name>*) since Nerd Fonts installs many family variants per archive.
Match granularity: A font is considered "installed" when at least one family matching <NerdFontName>* is present at the requested scope. This is intentionally permissive — partially-installed archives can be reinstalled with -Force.
Where the check goes: Immediately before the download step, inside the per-font loop. Keeps the diff small and localized.
Implementation plan
When a user re-runs
Install-NerdFont -Name 'FiraCode'(for example after rerunning a setup script, or with-Allon a partially-installed system), the function downloads and extracts the archive even if the font is already present. The actual install step insideInstall-Fontis a no-op without-Force, but the bandwidth and disk I/O leading up to it are spent regardless.Request
Current experience
Re-running the command on a system where the font is already installed still downloads tens of megabytes per font and extracts each archive. The end state is unchanged.
Desired experience
When the font is already installed at the requested scope and
-Forceis not specified,Install-NerdFontskips the download and extraction phases entirely for that font and emits a clear verbose message ("already installed, skipping"). With-Forcethe current behavior is preserved.Acceptance criteria
-Forceis not used-Forcecontinues to overwrite/reinstall as today-All) only download archives for fonts that actually need installingRelated
Get-Font— used to detect existing installationsTechnical decisions
Detection: Use
Get-Font -Scope $Scopeonce at the start ofprocessto build aHashSet[string]of installed font family names. Match each candidate Nerd Font's name against the set with a single wildcard (<Name>*) since Nerd Fonts installs many family variants per archive.Match granularity: A font is considered "installed" when at least one family matching
<NerdFontName>*is present at the requested scope. This is intentionally permissive — partially-installed archives can be reinstalled with-Force.Where the check goes: Immediately before the download step, inside the per-font loop. Keeps the diff small and localized.
Implementation plan
src/functions/public/Install-NerdFont.ps1, after resolving$nerdFontsToInstall, callGet-Font -Scope $Scopeonce and store the family names in aHashSet[string](case-insensitive)<font.Name>*-Forceis not set,Write-Verbose"already installed, skipping" andcontinue-Forceand asserts no download occurred (mockInvoke-WebRequest)-Forceand asserts the download did occur