Skip to content

fix(personality): make -l, -R and -c work as documented - #664

Merged
brianjfox merged 1 commit into
mainfrom
fix/personality-options
Aug 14, 2026
Merged

fix(personality): make -l, -R and -c work as documented#664
brianjfox merged 1 commit into
mainfrom
fix/personality-options

Conversation

@brianjfox

Copy link
Copy Markdown
Owner

Summary

The personality builtin's help advertised -l, -L, -R and -c behaviors it didn't implement — personality -c echo $SHELL errored with bad option: -c, and -l/-R were accepted but ignored (worse, personality -l sh silently switched).

Closes #660

Changes

  • -l lists the available personalities (canonical names then aliases), one per line, without switching.
  • -R resets to the personality the shell was invoked with (a new Shell::invoked_personality, recorded by startup's set_personality call).
  • -c works without a personality name (runs under the current one) and takes the rest of the words as the command line, joined — so the issue's exact repro personality -c echo $SHELL now prints the shell path with status 0. personality zsh -c "cmd" keeps working. A bare -c and stray extra arguments are errors now instead of being silently ignored.
  • -L keeps its existing local-to-function switch (zsh's emulate -L semantics, already covered by tests and relied on by zsh-mode scripts); the help now documents that instead of the unimplemented "list marking current" wording, and the usage/-c lines match the implementation.

Verification

  • tests/harness/personality_test.sh grew 8 checks (listing without switching, -c with/without name, word joining, bare -c error, -R from both bash and zsh invocations, extra-argument rejection) — all pass.
  • ctest 23/23; run_diff 525/525; builtins/type/errors scoreboard suites still 0.

The help advertised options the builtin did not implement (issue #660):

- `-l' now lists the available personalities one per line without
  switching (it was silently ignored, so `personality -l sh' switched).
- `-R' resets to the personality the shell was INVOKED with, recorded
  by the first set_personality call at startup.
- `-c' no longer requires a personality name -- `personality -c echo
  $SHELL' runs under the current one -- and takes the REST of the words
  as the command line (joined), instead of scanning for a lone `-c'
  and quietly ignoring everything else.  A bare `-c' and stray extra
  arguments are now errors instead of being silently dropped.
- `-L' keeps its (tested, zsh-compatible) local-to-function switch;
  the help text now describes that instead of an unimplemented listing
  variant, and documents the new `-c' form.

Closes #660
@brianjfox
brianjfox merged commit 35ec467 into main Aug 14, 2026
1 check passed
@brianjfox
brianjfox deleted the fix/personality-options branch August 14, 2026 00:29
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.

personality builtin doesn't match the help text for it

1 participant