Merge branch 'master' of tblancbeyne/dotfiles into master
This commit is contained in:
commit
f3d1f70c88
|
@ -1 +1,3 @@
|
|||
zsh/extraconfig.zsh
|
||||
|
||||
.data
|
||||
|
|
|
@ -1,3 +1,49 @@
|
|||
_check_date_file() {
|
||||
mkdir -p ~/.config/dotfiles/.data
|
||||
touch ~/.config/dotfiles/.data/update_date
|
||||
}
|
||||
|
||||
_sentence() {
|
||||
subject0=("Your" "The" "This")
|
||||
subject1=("system" "machine" "pc" "computer")
|
||||
adjective=("awesome" "incredible" "amazing" "brave" "hard working" "loyal" "nice" "polite" "powerful" "pro-active" "reliable" "fabulous" "fantastic" "incredible" "outstanding" "remarkable" "spectacular" "splendid" "super" "happy" "cheerful")
|
||||
verb=("is" "seems" "looks" "appears to be")
|
||||
no_verb=("is not" "doesn't seem" "doesn't look" "appears not to be")
|
||||
adverb=("up-to-date" "ready" "updated")
|
||||
dot=("." "!" "...")
|
||||
|
||||
n_subject0=`shuf -i1-"${#subject0[@]}" -n1`
|
||||
n_subject1=`shuf -i1-"${#subject1[@]}" -n1`
|
||||
n_adjective=`shuf -i1-"${#adjective[@]}" -n1`
|
||||
n_adverb=`shuf -i1-"${#adverb[@]}" -n1`
|
||||
n_dot=`shuf -i1-"${#dot[@]}" -n1`
|
||||
|
||||
if [ $1 = "updated" ]; then
|
||||
color="32"
|
||||
n_verb=`shuf -i1-"${#verb[@]}" -n1`
|
||||
s_verb=$verb[$n_verb]
|
||||
elif [ $1 = "not_updated" ]; then
|
||||
color="31"
|
||||
n_verb=`shuf -i1-"${#no_verb[@]}" -n1`
|
||||
s_verb=$no_verb[$n_verb]
|
||||
fi
|
||||
|
||||
echo "\033[$color;1m$subject0[$n_subject0] $adjective[$n_adjective] $subject1[$n_subject1] $s_verb $adverb[$n_adverb]$dot[$n_dot]\033[0m"
|
||||
}
|
||||
|
||||
_check_date() {
|
||||
_check_date_file
|
||||
|
||||
old_date=`cat ~/.config/dotfiles/.data/update_date`
|
||||
new_date=`date +%d/%m/%y`
|
||||
|
||||
if [ "$new_date" != "$old_date" ]; then
|
||||
_sentence not_updated
|
||||
else
|
||||
_sentence updated
|
||||
fi
|
||||
}
|
||||
|
||||
update-system() {
|
||||
|
||||
# Ask for sudo right now
|
||||
|
@ -161,4 +207,6 @@ update() {
|
|||
formatted=`date -ud "@$seconds" +'%H hours %M minutes %S seconds'`
|
||||
echo "\033[32;1m=== Update finished in $formatted ===\033[0m"
|
||||
|
||||
_check_date_file
|
||||
date +%d/%m/%y > ~/.config/dotfiles/.data/update_date
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue