0
0
mirror of https://github.com/tj/n.git synced 2024-11-21 18:48:57 +01:00

Started n(1)

This commit is contained in:
Tj Holowaychuk 2011-01-05 06:02:02 -08:00
parent 73896ff4a6
commit 1667a31d61

62
bin/n
View File

@ -1,3 +1,63 @@
#!/usr/bin/env sh
VERSION="0.0.1"
# Library version
VERSION="0.0.1"
# curl / wget support
GET=
# wget support
which wget > /dev/null && GET="wget -q -O-"
# curl support
which curl > /dev/null && GET="curl -# -L"
#
# Log the given <msg ...>
#
log() {
echo "... $@"
}
#
# Output usage information.
#
display_help() {
cat <<-help
Usage: n [options] <version>
Options:
-V, --version Output current version of n
-h, --help Display help information
help
exit 0
}
#
# Output n version.
#
display_n_version() {
echo $VERSION && exit 0
}
# Handle arguments
if test $# -eq 0; then
display_versions
else
while test $# -ne 0; do
case $1 in
-V|--version) display_n_version ;;
-h|--help) display_help ;;
esac
shift
done
fi