meaningful-ooo / sponge

🧽 Clean fish history from typos automatically
MIT License
267 stars 2 forks source link

Does not work #4

Open SuperSamus opened 1 year ago

SuperSamus commented 1 year ago

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 commented 1 year ago

👋🏻 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 commented 1 year ago
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:

andreiborisov commented 1 year ago

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 commented 1 year ago
> 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 commented 1 year ago

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