Repository navigation
fix: enable shell alias expansion in ! command - #5621
Merged
Merged
Conversation
Enable alias expansion for zsh and bash when running shell commands via the ! prefix. Previously, aliases weren't expanded because the command was parsed before aliases were loaded. The fix: - Use eval to defer command parsing until after aliases are loaded - Add 'shopt -s expand_aliases' for bash (required for alias expansion) - Use JSON.stringify for proper escaping of the command string Closes anomalyco#4351
Zeko369
force-pushed
the
fix/shell-aliases-expansion
branch
from
December 16, 2025 10:11
a3676c3 to
c3a87d0
Compare
Contributor
|
@Zeko369 In theory, this would be fantastic! My bash/fish aliases are burned into my muscle memory by now, I have to constantly remind myself that they don't work in opencode's Shell mode and shake my fist ruefully at the wasted extra keystrokes (who wants to tire their fingers out typing Looking at the diff, though, it doesn't look like this is going to work properly for fish/zsh/nu users (or probably for Windows who use Powershell either, I guess? Can't test, no Windows here). Is there anything we can do about that? |
Collaborator
|
Thank you @Zeko369 |
nalin-singh
pushed a commit
to nalin-singh/opencode
that referenced
this pull request
Dec 17, 2025
rekram1-node
pushed a commit
that referenced
this pull request
Dec 27, 2025
Rwanbt
pushed a commit
to Rwanbt/unifia
that referenced
this pull request
May 5, 2026
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
Rwanbt
pushed a commit
to Rwanbt/unifia
that referenced
this pull request
Jun 14, 2026
MarsQiu007
referenced
this pull request
in MarsQiu007/openNovel
Jul 31, 2026
meSingh
pushed a commit
to meSingh/opencode
that referenced
this pull request
Sep 6, 2026
androidand
pushed a commit
to androidand/opencode-skein
that referenced
this pull request
Sep 19, 2026
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
Fixes shell aliases not working when using the
!command prefix (e.g.,! g statuswheregis aliased togit).Closes #4351
Problem
Shell aliases weren't being expanded because:
shopt -s expand_aliases(bash), the command was already parsed before the aliases were loadedSolution
shopt -s expand_aliasesfor bash to enable alias expansion (works in ZSH without it)evalto defer parsing until after aliases are loadedJSON.stringifyto properly escape the command string