Skip to content

Commit

Permalink
fix: Fixes fish_command_not_found glob error (jdx#4133)
Browse files Browse the repository at this point in the history
An error for `fish_command_not_found` was introduce in jdx#4094 because
glob misses do not work the same in fish as in other shells. As such,
we are getting the following error on an unknown function:

```
- (line 64): No matches for wildcard '"mise-"*'. See `help wildcards-globbing`.
    if test "$argv[1]" != "mise" -a "$argv[1]" != "mise-"*
```

This has been replaced with a fish-specific implementation test that
prevents the error and is somewhat more idiomatic as well.
  • Loading branch information
halostatue authored Jan 17, 2025
1 parent de703d8 commit 6ccb1d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/shell/fish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ impl Shell for Fish {
end
function fish_command_not_found
if test "$argv[1]" != "mise" -a "$argv[1]" != "mise-"*
and {exe} hook-not-found -s fish -- $argv[1]
if string match -qrv '^(?:mise$|mise-)' $argv[1] &&
{exe} hook-not-found -s fish -- $argv[1]
{exe} hook-env{flags} -s fish | source
else if functions -q __mise_fish_command_not_found
__mise_fish_command_not_found $argv
Expand Down
4 changes: 2 additions & 2 deletions src/shell/snapshots/mise__shell__fish__tests__activate.snap
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ if functions -q fish_command_not_found; and not functions -q __mise_fish_command
end

function fish_command_not_found
if test "$argv[1]" != "mise" -a "$argv[1]" != "mise-"*
and /some/dir/mise hook-not-found -s fish -- $argv[1]
if string match -qrv '^(?:mise$|mise-)' $argv[1] &&
/some/dir/mise hook-not-found -s fish -- $argv[1]
/some/dir/mise hook-env --status -s fish | source
else if functions -q __mise_fish_command_not_found
__mise_fish_command_not_found $argv
Expand Down

0 comments on commit 6ccb1d9

Please sign in to comment.