akinomyoga / ble.sh

Bash Line Editor―a line editor written in pure Bash with syntax highlighting, auto suggestions, vim modes, etc. for Bash interactive sessions.
BSD 3-Clause "New" or "Revised" License
2.47k stars 80 forks source link

Update reminders #346

Open mooreye opened 1 year ago

mooreye commented 1 year ago

Do you think it would be a good idea to implement auto-reminders in the shell, by default every 2 weeks or so, to run ble-update? oh-my-zsh has this.

akinomyoga commented 1 year ago

I once thought about it but decided not to implement it as the default behavior.

One of the reasons is that an automatic update can pull an unstable version. Since ble.sh is continuously developed, the latest commit is sometimes unstable for a short period. Also, the update can introduce breaking changes to a configuration interface. For these reasons, I would like users to update ble.sh when they have time and are prepared to adjust their configurations and handle or report possible issues caused by the updates. I wouldn't like to suggest users update ble.sh on random occasions regardless of the users' situation.

Nevertheless, I guess it would be useful to have an extra module for such behavior as an opt-in feature. I'd accept a PR in the blesh-contrib repository.

mooreye commented 1 year ago

How about updating to the latest non-master tagged version?

akinomyoga commented 1 year ago

The non-master tagged version is rarely updated less than once per year.

mooreye commented 1 year ago

This was easy enough to implement, this is a small PoC that I started using myself at the end of ~/.bashrc:

# 'ble.sh' update checker
if [[ $- == *i* && -d $HOME/.blesh/.git ]]; then
    _blesh_check() {
        local file=$HOME/.blesh/.git/FETCH_HEAD
        if [[ ! -f $file ]]; then
            echo "ble.sh never updated, consider running 'ble-update'"
        elif local days_ago=14 && [[ $(find "$file" -mtime "+$days_ago" -print) ]]; then
            echo "ble.sh older than $days_ago days, consider running 'ble-update'"
        fi
    }
    _blesh_check
fi
jkemp814 commented 4 months ago

How can I make ble-update run in a script? I keep getting command not found, even though it will run at prompt fine.

akinomyoga commented 4 months ago

See README §1.5:

$ bash /path/to/ble.sh --update