Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work #4

Open
SuperSamus opened this issue Apr 4, 2023 · 5 comments
Open

Does not work #4

SuperSamus opened this issue Apr 4, 2023 · 5 comments

Comments

@SuperSamus
Copy link

Title.
I install Sponge, I type wrong commands, and they all stay in history.

However, all of its related functions (like _sponge_on_prompt, _sponge_remove_from_history or sponge_filter_failed) are visible to Fish.
In fact, I can make Sponge work by manually executing _sponge_install and _sponge_on_prompt.

I tried clearing the Fish configuration from ~/.config, but it changed nothing.

Though I have to note that I didn't install Sponge the "traditional" way (i.e. via Fisher), but via Nix. However, I installed all the other extensions the same way, and they work fine.

@andreiborisov
Copy link
Member

andreiborisov commented Apr 4, 2023

👋🏻 Thank you for reporting this!

Please, post the output of these commands so we can find out what's going on:

fish --version
functions --handlers | grep sponge
set --show | grep sponge

If you can share the list of the plugins you have installed, that also might help to diagnose the issue.

@SuperSamus
Copy link
Author

fish, version 3.6.1
sponge_install _sponge_install
sponge_uninstall _sponge_uninstall
$sponge_allow_previously_successful: set in universal scope, unexported, with 1 elements
$sponge_allow_previously_successful[1]: |true|
$sponge_delay: set in universal scope, unexported, with 1 elements
$sponge_delay[1]: |2|
$sponge_filters: set in universal scope, unexported, with 2 elements
$sponge_filters[1]: |sponge_filter_failed|
$sponge_filters[2]: |sponge_filter_matched|
$sponge_purge_only_on_exit: set in universal scope, unexported, with 1 elements
$sponge_purge_only_on_exit[1]: |false|
$sponge_regex_patterns: set in universal scope, unexported, with 0 elements
$sponge_successful_exit_codes: set in universal scope, unexported, with 1 elements
$sponge_successful_exit_codes[1]: |0|
$sponge_version: set in global scope, unexported, with 1 elements
$sponge_version[1]: |1.1.0|

The other plugins installed are:

  • tide
  • done
  • fzf-fish
  • grc
  • colored-man-pages

@andreiborisov
Copy link
Member

Interesting... it seems Sponge event handlers are not attached.

Please, post the output of these commands 🙏🏻.

Firstly, check if the functions indeed are available:

functions --all | grep sponge

After that try attaching them manually:

functions --query _sponge_on_prompt _sponge_on_preexec _sponge_on_postexec _sponge_on_exit

Finally, check if they've been successfully attached:

functions --handlers | grep sponge

@SuperSamus
Copy link
Author

> functions --all | grep sponge
_sponge_clear_state
_sponge_install
_sponge_on_exit
_sponge_on_postexec
_sponge_on_preexec
_sponge_on_prompt
_sponge_remove_from_history
_sponge_uninstall
sponge_filter_failed
sponge_filter_matched

> functions --query _sponge_on_prompt _sponge_on_preexec _sponge_on_postexec _sponge_on_exit
contains: Key not specified
test: Unexpected argument type at index 1
= true -a true = true
 ^
/run/current-system/sw/share/fish/vendor_functions.d/sponge_filter_failed.fish (line 4): 
  if test $previously_in_history = true -a $sponge_allow_previously_successful = true
     ^
in function 'sponge_filter_failed' with arguments '0'
        called on line 14 of file /run/current-system/sw/share/fish/vendor_functions.d/_sponge_on_postexec.fish
in function '_sponge_on_postexec' with arguments 'functions\ --query\ _sponge_on_prompt\ _sponge_on_preexec\ _sponge_on_postexec\ _sponge_on_exit'
in event handler: handler for generic event “fish_postexec”

> functions --handlers | grep sponge
fish_exit _sponge_on_exit
fish_postexec _sponge_on_postexec
fish_preexec _sponge_on_preexec
fish_prompt _sponge_on_prompt
sponge_install _sponge_install
sponge_uninstall _sponge_uninstall

If functions --handlers | grep sponge is the first command, then the output is:

sponge_install _sponge_install
sponge_uninstall _sponge_uninstall

@sbstn87
Copy link

sbstn87 commented Sep 2, 2023

I have the same issue.

Here's my output:
functions --all | grep sponge
_sponge_clear_state
_sponge_install
_sponge_on_exit
_sponge_on_postexec
_sponge_on_preexec
_sponge_on_prompt
_sponge_remove_from_history
_sponge_uninstall
sponge_filter_failed
sponge_filter_matched

functions --query _sponge_on_prompt _sponge_on_preexec _sponge_on_postexec _sponge_on_exit

functions --handlers | grep sponge
fish_exit _sponge_on_exit
fish_postexec _sponge_on_postexec
fish_preexec _sponge_on_preexec
fish_prompt _sponge_on_prompt
sponge_install _sponge_install
sponge_uninstall _sponge_uninstall

halostatue added a commit to halostatue/sponge that referenced this issue Jan 21, 2024
I got the following error block after installing 1.1.0 on every new tab.

```
contains: Key not specified
test: Unexpected argument type at index 1
= true -a true = true
 ^
~/.config/fish/functions/sponge_filter_failed.fish (line 4):
  if test $previously_in_history = true -a $sponge_allow_previously_successful = true
     ^
in function 'sponge_filter_failed' with arguments '0 ""'
	called on line 14 of file ~/.config/fish/functions/_sponge_on_postexec.fish
in function '_sponge_on_postexec'
	called on line 1 of file ~/.config/fish/config.fish
in event handler: handler for generic event “fish_postexec”
	called on line 378 of file ~/.config/fish/config.fish
```

This fixes both issues. Everything else *appears* to work. This may
address meaningful-ooo#4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants