Permalink
Browse files

Started n(1)

  • Loading branch information...
1 parent 73896ff commit 1667a31d61e4d91c36052e3f67f56227f8ef1412 @tj committed Jan 5, 2011
Showing with 61 additions and 1 deletion.
  1. +61 −1 bin/n
View
62 bin/n
@@ -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

0 comments on commit 1667a31

Please sign in to comment.