mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-11 11:43:03 +03:00
feat(console): adapt some scripts for termux
This commit is contained in:
parent
49398d4cb8
commit
87626e0539
3 changed files with 26 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
# [[file:../../Console.org::*Fish][Fish:1]]
|
# [[file:../../Console.org::*Fish][Fish:1]]
|
||||||
if [ "$TERM" != "dumb" ]
|
if [ "$TERM" != "dumb" ]; and type -q starship
|
||||||
starship init fish | source
|
starship init fish | source
|
||||||
end
|
end
|
||||||
# Fish:1 ends here
|
# Fish:1 ends here
|
||||||
|
|
@ -20,7 +20,7 @@ alias cad="conda activate (basename (pwd))"
|
||||||
# Fish:2 ends here
|
# Fish:2 ends here
|
||||||
|
|
||||||
# [[file:../../Console.org::*Fish][Fish:3]]
|
# [[file:../../Console.org::*Fish][Fish:3]]
|
||||||
if ! test -n "$TMUX"; and ! test -n "$IS_EMACS";
|
if ! test -n "$TMUX"; and ! test -n "$IS_EMACS"; and type -q colorscript
|
||||||
colorscript random
|
colorscript random
|
||||||
end
|
end
|
||||||
# Fish:3 ends here
|
# Fish:3 ends here
|
||||||
|
|
|
||||||
19
Console.org
19
Console.org
|
|
@ -432,7 +432,7 @@ init_yc () {
|
||||||
|
|
||||||
Launch starship
|
Launch starship
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
if [ "$TERM" != "dumb" ]
|
if [ "$TERM" != "dumb" ]; and type -q starship
|
||||||
starship init fish | source
|
starship init fish | source
|
||||||
end
|
end
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
@ -452,7 +452,7 @@ alias cad="conda activate (basename (pwd))"
|
||||||
|
|
||||||
Launch a random [[https://gitlab.com/dwt1/shell-color-scripts][DT's colorscript]] unless ran inside tmux or Emacs.
|
Launch a random [[https://gitlab.com/dwt1/shell-color-scripts][DT's colorscript]] unless ran inside tmux or Emacs.
|
||||||
#+begin_src fish
|
#+begin_src fish
|
||||||
if ! test -n "$TMUX"; and ! test -n "$IS_EMACS";
|
if ! test -n "$TMUX"; and ! test -n "$IS_EMACS"; and type -q colorscript
|
||||||
colorscript random
|
colorscript random
|
||||||
end
|
end
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
@ -894,9 +894,16 @@ PUSHED="No"
|
||||||
FETCHED="No"
|
FETCHED="No"
|
||||||
MERGED="No"
|
MERGED="No"
|
||||||
|
|
||||||
|
notify () {
|
||||||
|
if command -v notify-send; then
|
||||||
|
notify-send -u ${LEVEL:-normal} "$1" "$2"
|
||||||
|
else
|
||||||
|
echo "$1" "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then
|
if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then
|
||||||
notify-send -u critical "Autocommit $(pwd)" "Merge conflict!"
|
LEVEL=critical notify "Autocommit $(pwd)" "Merge conflict!"
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ($RECENTLY_CHANGED_NUM -eq 0 || $2 = "-F") && $CHANGED_NUM -gt 0 ]]; then
|
if [[ ($RECENTLY_CHANGED_NUM -eq 0 || $2 = "-F") && $CHANGED_NUM -gt 0 ]]; then
|
||||||
|
|
@ -932,11 +939,11 @@ Fetched: $FETCHED
|
||||||
Merged: $MERGED
|
Merged: $MERGED
|
||||||
Pushed: $PUSHED
|
Pushed: $PUSHED
|
||||||
EOM
|
EOM
|
||||||
notify-send "Autocommit $(pwd)" "$NOTIFICATION"
|
notify "Autocommit $(pwd)" "$NOTIFICATION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then
|
if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then
|
||||||
notify-send -u critical "Autocommit $(pwd)" "Merge conflict!"
|
LEVEL=critical notify "Autocommit $(pwd)" "Merge conflict!"
|
||||||
fi
|
fi
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,16 @@ PUSHED="No"
|
||||||
FETCHED="No"
|
FETCHED="No"
|
||||||
MERGED="No"
|
MERGED="No"
|
||||||
|
|
||||||
|
notify () {
|
||||||
|
if command -v notify-send; then
|
||||||
|
notify-send -u ${LEVEL:-normal} "$1" "$2"
|
||||||
|
else
|
||||||
|
echo "$1" "$2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then
|
if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then
|
||||||
notify-send -u critical "Autocommit $(pwd)" "Merge conflict!"
|
LEVEL=critical notify "Autocommit $(pwd)" "Merge conflict!"
|
||||||
exit
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ($RECENTLY_CHANGED_NUM -eq 0 || $2 = "-F") && $CHANGED_NUM -gt 0 ]]; then
|
if [[ ($RECENTLY_CHANGED_NUM -eq 0 || $2 = "-F") && $CHANGED_NUM -gt 0 ]]; then
|
||||||
|
|
@ -52,10 +59,10 @@ Fetched: $FETCHED
|
||||||
Merged: $MERGED
|
Merged: $MERGED
|
||||||
Pushed: $PUSHED
|
Pushed: $PUSHED
|
||||||
EOM
|
EOM
|
||||||
notify-send "Autocommit $(pwd)" "$NOTIFICATION"
|
notify "Autocommit $(pwd)" "$NOTIFICATION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then
|
if [[ $(git ls-files -u | wc -l) -gt 0 ]]; then
|
||||||
notify-send -u critical "Autocommit $(pwd)" "Merge conflict!"
|
LEVEL=critical notify "Autocommit $(pwd)" "Merge conflict!"
|
||||||
fi
|
fi
|
||||||
# =autocommit=:1 ends here
|
# =autocommit=:1 ends here
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue