dotfiles/zsh/functions.zsh

37 lines
478 B
Bash
Raw Normal View History

2018-06-15 13:43:04 +00:00
#!/usr/bin/env zsh
2018-02-23 09:38:24 +00:00
is_linux() {
2018-07-04 20:55:45 +00:00
[[ "$OSTYPE" == linux* ]]
2018-02-23 09:38:24 +00:00
}
is_macos() {
2018-07-04 20:55:45 +00:00
[[ "$OSTYPE" == darwin* ]]
2018-02-23 09:38:24 +00:00
}
2018-08-23 20:46:00 +00:00
is_android() {
[[ "$OSTYPE" == linux-android ]]
}
2018-02-23 09:38:24 +00:00
command_exists() {
command -v "$1" >/dev/null 2>&1
}
source_if_exists() {
2018-07-04 20:55:45 +00:00
[[ -f "$1" ]] && source "$1"
2018-02-23 09:38:24 +00:00
}
2018-11-10 20:03:34 +00:00
lazy_load() {
local command="$1"
local init_command="$2"
2019-01-09 16:55:19 +00:00
eval "$command() {
unfunction $command
$init_command
$command \$@
}"
}
2019-03-08 18:10:30 +00:00
welcome() {
python "$ZSH_DOTFILES/welcome/main.py"
2019-03-08 18:10:30 +00:00
}