What problem are you trying to solve?
cdd init supports fish, bash, and zsh only. PowerShell users, on Windows and on Linux and macOS with pwsh, cannot Jump: the binary prints a path but there is no Wrapper to change the caller's directory.
Proposed solution
Add powershell (alias pwsh) to cdd init, emitting a function that starship and zoxide have already proven works:
Invoke-Expression (& cdd init powershell | Out-String)
The emitted cdd function forwards the pass-through subcommands (help, completion, init, scan, version) to the binary, otherwise captures & cdd pick @args, checks $LASTEXITCODE, guards against an empty result, and runs Set-Location -LiteralPath. The pass-through list continues to come from the cobra command tree.
Alternatives considered
- Asking users to write their own function. Defeats the
cdd init <shell> contract.
Additional context
What problem are you trying to solve?
cdd initsupports fish, bash, and zsh only. PowerShell users, on Windows and on Linux and macOS with pwsh, cannot Jump: the binary prints a path but there is no Wrapper to change the caller's directory.Proposed solution
Add
powershell(aliaspwsh) tocdd init, emitting a function that starship and zoxide have already proven works:The emitted
cddfunction forwards the pass-through subcommands (help, completion, init, scan, version) to the binary, otherwise captures& cdd pick @args, checks$LASTEXITCODE, guards against an empty result, and runsSet-Location -LiteralPath. The pass-through list continues to come from the cobra command tree.Alternatives considered
cdd init <shell>contract.Additional context
CONIN$/CONOUT$instead of/dev/tty, and Windows binaries are not built yet. Shipping pwsh on Linux and macOS first is a reasonable first slice, with Windows binaries and GoReleaser targets as a follow-up.