From 1667a31d61e4d91c36052e3f67f56227f8ef1412 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Wed, 5 Jan 2011 06:02:02 -0800 Subject: [PATCH] Started n(1) --- bin/n | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/bin/n b/bin/n index a7b921f..662025c 100755 --- a/bin/n +++ b/bin/n @@ -1,3 +1,63 @@ #!/usr/bin/env sh -VERSION="0.0.1" \ No newline at end of file +# 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 +# + +log() { + echo "... $@" +} + +# +# Output usage information. +# + +display_help() { + cat <<-help + + Usage: n [options] + + 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 \ No newline at end of file