ble.sh icon indicating copy to clipboard operation
ble.sh copied to clipboard

Update reminders

Open mooreye opened this issue 2 years ago • 6 comments

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.

mooreye avatar Jul 20 '23 13:07 mooreye

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.

akinomyoga avatar Jul 20 '23 14:07 akinomyoga

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

mooreye avatar Jul 20 '23 14:07 mooreye

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

akinomyoga avatar Jul 20 '23 15:07 akinomyoga

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

mooreye avatar Jul 23 '23 22:07 mooreye

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

jkemp814 avatar Apr 04 '24 20:04 jkemp814

See README §1.5:

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

akinomyoga avatar Apr 04 '24 21:04 akinomyoga