Skip to content

fix: accept optional shell arg in 'wt shell-init' - #6

Merged
sahil-noon merged 1 commit into
mainfrom
merry-oriole
May 10, 2026
Merged

sahil-noon merged 1 commit into
mainfrom
merry-oriole

Conversation

@sahil-noon

Copy link
Copy Markdown
Collaborator

Summary

  • shll shell-init <shell> invokes each registered tool's shell-init subcommand and forwards the shell name as a positional arg. wt shell-init was declared with cobra.NoArgs, so wt shell-init zsh failed with unknown command "zsh" for "wt shell-init", breaking shll's composed eval output.
  • Relax to cobra.MaximumNArgs(1). When provided, the arg overrides $SHELL for the supported-shell warning check. Wrapper output is unchanged (the wrapper is shell-agnostic between bash/zsh).
  • Added 4 tests: explicit zsh arg overrides unsupported $SHELL, explicit bash arg with empty $SHELL, unsupported shell as arg (warns), and >1 args (rejected).

Test plan

  • go test ./cmd/wt/ -run TestShellInit -v — all 8 tests pass
  • go test ./... — full suite green
  • Smoke test: wt shell-init zsh emits the wrapper cleanly; wt shell-init zsh extra errors with accepts at most 1 arg(s)
  • Verify eval "$(shll shell-init zsh)" succeeds end-to-end after this lands

shll shell-init <shell> shells out to each registered tool's shell-init
subcommand and forwards the shell name as a positional argument. wt
shell-init was declared with cobra.NoArgs, so 'wt shell-init zsh' failed
with 'unknown command "zsh" for "wt shell-init"', breaking shll's
composed eval output.

Relax to cobra.MaximumNArgs(1). When provided, the arg overrides $SHELL
for the supported-shell check; the wrapper output is unchanged (it is
shell-agnostic between bash/zsh).
@sahil-noon
sahil-noon merged commit dc37482 into main May 10, 2026
@sahil-noon
sahil-noon deleted the merry-oriole branch May 10, 2026 10:39
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.

2 participants