Make the script curl runnable

This commit is contained in:
Chris Sexton 2015-03-05 12:27:05 -05:00
parent 4b126bd540
commit 39acf5cae1
1 changed files with 16 additions and 7 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash -e #!/bin/bash -e
CMD="$0" set -o pipefail
[ "$NAME" ] || NAME= [ "$NAME" ] || NAME=
[ "$EMAIL" ] || EMAIL= [ "$EMAIL" ] || EMAIL=
@ -13,12 +13,17 @@ die() { echo "$1" 1>&2 && show_help && [ "$2" ] && [ "$2" -ge 0 ] && exit "$2" |
# Show help function to be used below # Show help function to be used below
show_help() { show_help() {
awk 'NR>1{print} /^(###|$)/{exit}' "$CMD" echo "USAGE: setup.sh [arguments]"
echo "USAGE: $(basename "$CMD") [arguments]"
echo "ARGS:" echo "ARGS:"
MSG=$(awk '/^NARGS=-1; while/,/^esac; done/' "$CMD" | sed -e 's/^[[:space:]]*/ /' -e 's/|/, /' -e 's/)//' | grep '^ -') cat <<HELP
EMSG=$(eval "echo \"$MSG\"") -h, --help # This help message
echo "$EMSG" -n, --name # Name for git
-e, --email # Email for git
-s, --server # Server for irssi
-P, --port # Port for irssi
-N, --nick # Nick for irssi
-p, --password # Password for irssi
HELP
} }
# Parse command line options (odd formatting to simplify show_help() above) # Parse command line options (odd formatting to simplify show_help() above)
@ -66,7 +71,11 @@ elif [[ "$UNAMESTR" == 'Darwin' ]]; then
true true
fi fi
git clone git@git.chrissexton.org:cws/dotfiles.git "$HOME"/.dotfiles if [ ! -d "$HOME"/.dotfiles ]; then
git clone git@git.chrissexton.org:cws/dotfiles.git "$HOME"/.dotfiles
elif [ ! -d "$HOME"/.dotfiles/files ]; then
die "You must have a destination for the dotfiles repository!"
fi
DOTFILES="$HOME"/.dotfiles DOTFILES="$HOME"/.dotfiles
cat "$DOTFILES"/files/gitignore_global > "$HOME"/.gitignore_global cat "$DOTFILES"/files/gitignore_global > "$HOME"/.gitignore_global