From f2f8ef88a50f0edadd9fec139777a9220035687e Mon Sep 17 00:00:00 2001 From: Ryan Baumann Date: Wed, 10 Aug 2011 09:53:24 -0400 Subject: [PATCH] Implement some basic command line help --- libexec/rbenv | 2 +- libexec/rbenv-help | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100755 libexec/rbenv-help diff --git a/libexec/rbenv b/libexec/rbenv index 66d8c438..74ab8928 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -19,7 +19,7 @@ export PATH="${libexec_path}:${PATH}" command="$1" if [ -z "$command" ]; then - echo "rbenv 0.1.0" >&2 + echo -e "rbenv 0.1.0\n$(rbenv-help)" >&2 else command_path="$(command -v "rbenv-$command" || true)" diff --git a/libexec/rbenv-help b/libexec/rbenv-help new file mode 100755 index 00000000..dcf671ac --- /dev/null +++ b/libexec/rbenv-help @@ -0,0 +1,43 @@ +#!/usr/bin/env bash -e + +print_set_version() { + echo " should be a string matching the installed Ruby name known by rbenv. + +For your install, this is currently one of: + +$(rbenv-versions --bare) + +The special version string 'system' will use your default system Ruby." +} + +case "$1" in +"") echo "usage: rbenv [] + +Some useful rbenv commands are: + commands List all commands + rehash Rehash rbenv shims, use after installing binaries + set-default Set global default Ruby + set-local Set local directory default Ruby + version Show Ruby version being used + versions List Ruby versions known by rbenv + +See 'rbenv help ' for more information on a specific command. +For a quick guide to rbenv, see: https://gist.github.com/1120938" +;; +set-default) echo "usage: rbenv set-default + +Sets the global default Ruby. + +$(print_set_version)" +;; +set-local) echo "usage: rbenv set-local + +Sets the local directory default Ruby, by writing the version to a file +named '.rbenv-version'. rbenv will search for this file up the directory +tree from the current working directory each time its shims are executed, +so this default will affect subdirectories. + +$(print_set_version)" +;; +*) echo "No command arguments needed or invalid/undocumented command." +esac