zshrc: ls multisystem fix (#10)

1. alias l according to the local os type
2. ci sync triggered by all branches
This commit is contained in:
Dict Xiong 2022-08-25 00:23:29 +08:00 committed by GitHub
parent 7804f196b4
commit f313a6887e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 10 deletions

View File

@ -1,9 +1,6 @@
name: sync repos to gitee
on:
push:
branches:
- main
- dev
push: ~
schedule:
- cron: 10 4 * * *
workflow_dispatch: ~

37
.zshrc2
View File

@ -76,6 +76,38 @@ if (( $EUID != 0 )); then
SUDO='sudo'
fi
get_os_type() {
case "$(uname -s)" in
Darwin*) ans="MacOS";;
CYGWIN*) ans="Cygwin";;
MSYS* ) ans="MSYS";;
Linux* ) ans="Linux";;
*) ans="unknown";;
esac
echo $ans | tr '[:upper:]' '[:lower:]'
}
get_linux_dist() {
if [ -f /etc/os-release ]; then
. /etc/os-release
ans=$ID
elif type lsb_release >/dev/null 2>&1; then
ans=$(lsb_release -si)
elif [ -f /etc/lsb-release ]; then
. /etc/lsb-release
ans=$DISTRIB_ID
elif [ -f /etc/debian_version ]; then
ans=Debian
elif [ -f /etc/SuSe-release ]; then
ans=SUSE
elif [ -f /etc/redhat-release ]; then
ans=RedHat
else
ans=unknown
fi
echo $ans | tr '[:upper:]' '[:lower:]'
}
dfs()
{
case $1 in
@ -117,7 +149,10 @@ alias "se"='sudo -sE'
alias "pbd"='ping baidu.com'
alias "p114"='ping 114.114.114.114'
alias "p666"='ping6 2001:da8::666'
alias l='ls -lAGh --time-style="+%y-%m-%d %H:%M"'
case $(get_os_type) in
macos ) alias l='ls -lAGh -D "%y-%m-%d %H:%M"' ;;
* ) alias l='ls -lAGh --time-style="+%y-%m-%d %H:%M"' ;;
esac
# key bindings
bindkey "^b" beginning-of-line

View File

@ -18,12 +18,8 @@ apk_add()
apk update
# mass installation
apk add zsh git tmux vim curl wget bash python3 htop gcc g++ cmake make fzf perl linux-headers bind-tools iputils man-db
apk add zsh git tmux vim curl wget bash python3 htop gcc g++ cmake make fzf perl linux-headers bind-tools iputils man-db coreutils
#for i in {fzf,ripgrep}; do apk add $i -y; done
# who am i
git config --global user.email "me@beardic.cn"
git config --global user.name "Dict Xiong"
}
set_timezone()