Merge branch 'master' of git.jpatrick.io:james/dotfiles
This commit is contained in:
commit
d35ca827a8
|
@ -15,7 +15,7 @@ return_val_truthy := && echo true || echo false
|
|||
cmd_exist = $(shell (($$+commands[$1])) $(return_val_truthy) )
|
||||
|
||||
# Shortcut for the XDG dir if it exist. default to ~/.confg
|
||||
XDG_DIR := $${XDG_CONFIG_DIR:-~/.config}
|
||||
XDG_DIR := $${XDG_CONFIG_HOME:-~/.config}
|
||||
|
||||
# Some things will OS specific.
|
||||
# With this you can use `$(IS_MAC) && echo "I'm a Mac" || echo "I'm not a Mac"`
|
||||
|
|
46
zsh/modules/bin/tellme
Executable file
46
zsh/modules/bin/tellme
Executable file
|
@ -0,0 +1,46 @@
|
|||
#! /bin/bash
|
||||
|
||||
export CONFIG=${XDG_CONFIG_HOME:-~/.config}/tellme/creds
|
||||
|
||||
# Load config file if it exist.
|
||||
[ -f $CONFIG ] && export $(grep -v '^#' $CONFIG | xargs)
|
||||
|
||||
usage(){
|
||||
echo "You have to tell me something"
|
||||
exit -1
|
||||
}
|
||||
|
||||
setup(){
|
||||
echo "It doesn't look like I've been setup yet. I will need the Application & User tokens."
|
||||
read -r -p " Application Token: " APPLICATION_TOKEN
|
||||
read -r -p " User Token: " USER_TOKEN
|
||||
mkdir -p $(dirname $CONFIG)
|
||||
cat <<-EOF > $CONFIG
|
||||
application_token=$APPLICATION_TOKEN
|
||||
user_token=$USER_TOKEN
|
||||
EOF
|
||||
chmod 600 $CONFIG
|
||||
echo "Config setup at $CONFIG"
|
||||
echo
|
||||
}
|
||||
|
||||
if [[ -z $application_token || -z $user_token ]] ; then
|
||||
setup
|
||||
export $(grep -v '^#' $CONFIG | xargs)
|
||||
fi
|
||||
|
||||
if [[ $# -eq 0 ]] ; then
|
||||
usage
|
||||
fi
|
||||
|
||||
message=$@
|
||||
curl -s \
|
||||
--form-string "token=$application_token" \
|
||||
--form-string "user=$user_token" \
|
||||
--form-string "message=$message" \
|
||||
https://api.pushover.net/1/messages.json \
|
||||
| grep "\"status\":1," 1>/dev/null
|
||||
|
||||
[[ $? -eq 0 ]] && echo "message sent" || echo "ERROR SENDING NOTIFICATION"
|
||||
|
||||
printf '\a' #Rings bell
|
16
zsh/zplug
16
zsh/zplug
|
@ -2,6 +2,18 @@
|
|||
|
||||
source ${ZPLUG_HOME}/init.zsh
|
||||
|
||||
zplug "junegunn/fzf-bin", \
|
||||
from:gh-r, \
|
||||
as:command, \
|
||||
rename-to:fzf
|
||||
|
||||
zplug "zdharma/zsh-diff-so-fancy", \
|
||||
as:command, \
|
||||
use:"bin/{git-dsf,diff-so-fancy}"
|
||||
|
||||
zplug "${ZDIR}/modules/bin/", \
|
||||
as:command, \
|
||||
use:"*"
|
||||
zplug "zdharma/fast-syntax-highlighting", \
|
||||
as:plugin, \
|
||||
defer:2
|
||||
|
@ -14,7 +26,9 @@ zplug "zsh-users/zsh-history-substring-search", \
|
|||
as:plugin, \
|
||||
defer:2
|
||||
|
||||
zplug "zpm-zsh/autoenv"
|
||||
zplug "zpm-zsh/autoenv", \
|
||||
as:plugin, \
|
||||
defer:2
|
||||
|
||||
zplug "zsh-users/zsh-autosuggestions", \
|
||||
as:plugin, \
|
||||
|
|
Loading…
Reference in New Issue
Block a user