Skip to content

Instantly share code, notes, and snippets.

@phroa
Last active August 29, 2015 14:18
Show Gist options
  • Save phroa/9e3fef51fd83734fbff2 to your computer and use it in GitHub Desktop.
Save phroa/9e3fef51fd83734fbff2 to your computer and use it in GitHub Desktop.
#!/usr/bin/zsh
zsh_extras_folder="$HOME/.zsh"
extras=(
"https://gist.githubusercontent.com/Phroa/5f1f4094e73a8c26d753/raw/245b42095e767d41ccee96250f7dad1d0f529778/__basics.zsh"
"https://gist.githubusercontent.com/Phroa/42e441fbf93f75ecd0f9/raw/969d8e97a1c9916f0a86afb02e62960b64b1e968/aliases.zsh"
"https://gist.githubusercontent.com/Phroa/5f49d78176efdf3e344c/raw/be163eaa6e183488678d82580a3bfde503624e84/prompt.zsh"
"https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/lib/key-bindings.zsh"
)
function download_extras() {
mkdir -p "$zsh_extras_folder"
for extra in "$extras[@]" ; do
if [[ ! -f "$extra" ]] ; then
printf "#### Downloading $(basename $extra)\n"
if (( $+commands[wget] )) ; then
wget -q -O "$zsh_extras_folder/$(basename $extra)" "$extra"
elif (( $+commands[curl] )) ; then
curl -LSs -o "$zsh_extras_folder/$(basename $extra)" "$extra"
fi
fi
done
}
if [[ ! -d "$zsh_extras_folder" ]] ; then
printf "#### It appears this is the first launch of this script.\n"
printf "#### Downloading extras into \"$zsh_extras_folder\".\n"
fi
download_extras
for file in "$zsh_extras_folder"/*.zsh(N) ; do
source "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment