franciscolourenco / done

A fish-shell package to automatically receive notifications when long processes finish.
MIT License
766 stars 70 forks source link

Unexpected and strange error "Unknown command: humanize_duration" #122

Closed romanrev closed 2 years ago

romanrev commented 2 years ago

After I've upgraded my Fisherman I've started getting this kind of strange error in my terminal after a command finishes. I've already tried removing the done plugin and installing it again, but it doesn't seem to help. I cannot find the humanize_duration in the done.fish file BTW, so not sure how to debug it. Any hints are greatly appreciated!

➤ fish --version fish, version 3.1.2 ➤ fisher --version fisher, version 4.3.0

fish: Unknown command: humanize_duration
~/.config/fish/conf.d/done.fish (line 1): 
echo "$cmd_duration" | humanize_duration
                       ^
in command substitution
    called on line 146 of file ~/.config/fish/conf.d/done.fish
in function '__done_ended'
in event handler: handler for generic event 'fish_prompt'
~/.config/fish/conf.d/done.fish: Unknown error while evaluating command substitution
in function '__done_ended'
in event handler: handler for generic event 'fish_prompt'
ammgws commented 2 years ago

Looks like you're on an old version of done, since that function was internalised in the code quite a while ago.

The error is probably because that package was renamed to humantime: https://github.com/jorgebucaran/humantime.fish/

Anyway, updating done should resolve your issue

romanrev commented 2 years ago

thanks for your prompt feedback @ammgws ! But I have already updated done, or so I thought at least, by running fisher update franciscolourenco/done - several times already in fact. Could you tell what is the way to confirm the update has actually happened, except for observing the output?

➤ fisher update franciscolourenco/done
fisher update version 4.3.0
Fetching https://codeload.github.com/franciscolourenco/done/tar.gz/HEAD
Installing franciscolourenco/done
           /Users/roman/.config/fish/conf.d/done.fish
Updated 1 plugin/s

thank you!

romanrev commented 2 years ago

ok, I've downloaded the done.fish file from GH directly and compared it to the one installed in my ~/.config/fish/conf.d/done.fish - they look identical:

➤ diff -u ~/.config/fish/conf.d/done.fish /tmp/done.fish
<nil>

I wonder if somehow the old done is still used in my shell? Do you know if there is a way to ensure the plugin code is reloaded in memory after update?

ammgws commented 2 years ago

I believe fisher is meant to source the new files automatically, perhaps try asking there? https://github.com/jorgebucaran/fisher/blob/b2c317a2aecb69727da9c2b88c730bb5537e2d26/functions/fisher.fish#L173-L174

Try running functions __done_humanize_duration, it should return the definition of the function, otherwise the currently loaded done.fish is old.

I recommend just spinning up a new shell for now.

romanrev commented 2 years ago

thanks for the hint with checking the function is defined, it was empty indeed! I've sourced the ~/.config/fish/conf.d/done.fish manually and it has obviously defined it correctly. I am guessing fisher is sourcing the new plugin files automatically once it is updated, but obviously that doesn't happen in the multitude of terminal tabs I have open on my computer 😁 Thanks again for hand-holding me, I am closing this ticket now

franciscolourenco commented 2 years ago

For future reference, you can also get the loaded version of done with

echo $__done_version
romanrev commented 2 years ago

great to know, thank you!