-
-
Save phyrog/fd4c5b6f51e5144cec1cc4d241369582 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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