Open mooreye opened 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.
How about updating to the latest non-master tagged version?
The non-master tagged version is rarely updated less than once per year.
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
How can I make ble-update run in a script? I keep getting command not found, even though it will run at prompt fine.
See README §1.5:
$ bash /path/to/ble.sh --update
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.