Skip to content

feat: add short interactive aliases for common cmdlets#30

Merged
austoonz merged 3 commits into
mainfrom
feat/cmdlet-aliases
Jun 26, 2026
Merged

feat: add short interactive aliases for common cmdlets#30
austoonz merged 3 commits into
mainfrom
feat/cmdlet-aliases

Conversation

@austoonz

Copy link
Copy Markdown
Owner

Summary

Adds 13 short ct/cf-prefixed aliases targeting cmdlets used interactively. The full module surface is not aliased — MemoryStream, CompressedByteArray, HashTable, and SecureString cmdlets are excluded as they are primarily used inside scripts where full names aid readability.

The three existing compatibility aliases (ConvertFrom-Base64StringToByteArray, ConvertFrom-ByteArrayToBase64String, ConvertFrom-StreamToString) are retained.

Alias Cmdlet
ctb64 ConvertTo-Base64
cfb64 ConvertFrom-Base64ToString
cthash ConvertTo-Hash
cthmac ConvertTo-HmacHash
cturl ConvertTo-EscapedUrl
cfurl ConvertFrom-EscapedUrl
ctut ConvertTo-UnixTime
cfut ConvertFrom-UnixTime
gut Get-UnixTime
ctc ConvertTo-Celsius
ctf ConvertTo-Fahrenheit
cttc ConvertTo-TitleCase
ctstr ConvertTo-String

cfb64 targets ConvertFrom-Base64ToString (not ConvertFrom-Base64) because it has lenient mode — UTF-8 with Latin-1 fallback when no encoding is specified — making it more forgiving for interactive use.

All aliases were verified against the PowerShell Gallery with Find-Module -Command — no collisions found.

Closes #26

Test plan

  • Global.Tests.ps1 asserts 16 exported aliases with full metadata verification (source, version, resolved command, visibility) for each
  • Each affected cmdlet's test file has an Alias context that asserts the short alias resolves to the correct function — prevents silent removal or remapping
  • Remaining -TestCases usages migrated to -ForEach in Global.Tests.ps1, ConvertTo-Hash.Tests.ps1, and ConvertTo-HmacHash.Tests.ps1
  • Run .\build.ps1 -PowerShell -Test to confirm all tests pass

🤖 Generated with Claude Code

austoonz added 3 commits June 26, 2026 14:58
Adds 13 short aliases targeting cmdlets used interactively rather than
aliasing the full module surface. Aliases follow the ct/cf prefix
convention and are exported via AliasesToExport in the module manifest.
The three existing compatibility aliases are retained.

New aliases:
  ctb64  -> ConvertTo-Base64
  cfb64  -> ConvertFrom-Base64ToString
  cthash -> ConvertTo-Hash
  cthmac -> ConvertTo-HmacHash
  cturl  -> ConvertTo-EscapedUrl
  cfurl  -> ConvertFrom-EscapedUrl
  ctut   -> ConvertTo-UnixTime
  cfut   -> ConvertFrom-UnixTime
  gut    -> Get-UnixTime
  ctc    -> ConvertTo-Celsius
  ctf    -> ConvertTo-Fahrenheit
  cttc   -> ConvertTo-TitleCase
  ctstr  -> ConvertTo-String

Closes #26
Adds an Alias context to each affected cmdlet's test file that asserts
the short alias resolves to the correct function. This prevents aliases
being silently removed or remapped in future.

Updates Global.Tests.ps1 to assert 16 exported aliases (was 3) with
full metadata verification for each new alias.

Migrates remaining -TestCases usages to -ForEach across Global.Tests.ps1,
ConvertTo-Hash.Tests.ps1, and ConvertTo-HmacHash.Tests.ps1 for
consistency with the Pester 5 idiomatic pattern used elsewhere.
@austoonz
austoonz force-pushed the feat/cmdlet-aliases branch from d9538fb to f5e2328 Compare June 26, 2026 22:07
@austoonz
austoonz merged commit cca5d58 into main Jun 26, 2026
23 checks passed
@austoonz
austoonz deleted the feat/cmdlet-aliases branch June 26, 2026 22:21
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.

Shorter Cmdlet Aliases

1 participant