Skip to content

Instantly share code, notes, and snippets.

@phyrog
Last active October 27, 2017 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phyrog/fd4c5b6f51e5144cec1cc4d241369582 to your computer and use it in GitHub Desktop.
Save phyrog/fd4c5b6f51e5144cec1cc4d241369582 to your computer and use it in GitHub Desktop.
#!/usr/bin/zsh
_dev() {
local -a dir
dir="$DEV"
_arguments '-p[Use playground]:playground:->playground' '--play[Use playground]:playground:->playground' '-n[New directory]:new' '--new[New directory]:new'
case "$state" in
playground)
dir="$PLAYGROUND"
esac
_path_files -W "$dir" -/
}
dev() {
zparseopts -D -E -- p=play -play=play n=new -new=new
local -a dir
dir="$DEV/$1"
if [[ ! -z $play ]]; then
dir="$PLAYGROUND/$1"
if [[ ! -z $new ]]; then
dir="$dir-${$(date +%s)}"
fi
fi
if [[ ! -z $new ]]; then
mkdir -p "$dir"
fi
cd "$dir"
ls
}
compdef '_dev' dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment