fix(personality): make -l, -R and -c work as documented - #664
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
personalitybuiltin's help advertised-l,-L,-Rand-cbehaviors it didn't implement —personality -c echo $SHELLerrored withbad option: -c, and-l/-Rwere accepted but ignored (worse,personality -l shsilently switched).Closes #660
Changes
-llists the available personalities (canonical names then aliases), one per line, without switching.-Rresets to the personality the shell was invoked with (a newShell::invoked_personality, recorded by startup'sset_personalitycall).-cworks 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 repropersonality -c echo $SHELLnow prints the shell path with status 0.personality zsh -c "cmd"keeps working. A bare-cand stray extra arguments are errors now instead of being silently ignored.-Lkeeps its existing local-to-function switch (zsh'semulate -Lsemantics, 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/-clines match the implementation.Verification
tests/harness/personality_test.shgrew 8 checks (listing without switching,-cwith/without name, word joining, bare-cerror,-Rfrom both bash and zsh invocations, extra-argument rejection) — all pass.builtins/type/errorsscoreboard suites still 0.