From b5a26936e8923b526ca3d71b73688e4e5f0cf876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohnic=CC=81?= Date: Thu, 13 Dec 2012 00:40:29 +0100 Subject: [PATCH] rbenv --version --- libexec/rbenv | 5 ++++- libexec/rbenv---version | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100755 libexec/rbenv---version diff --git a/libexec/rbenv b/libexec/rbenv index b0470f2f..d368d459 100755 --- a/libexec/rbenv +++ b/libexec/rbenv @@ -60,7 +60,10 @@ shopt -u nullglob command="$1" case "$command" in "" | "-h" | "--help" ) - echo -e "rbenv 0.3.0\n$(rbenv-help)" >&2 + echo -e "rbenv $(rbenv---version)\n$(rbenv-help)" >&2 + ;; +"-v" ) + exec rbenv---version ;; * ) command_path="$(command -v "rbenv-$command" || true)" diff --git a/libexec/rbenv---version b/libexec/rbenv---version new file mode 100755 index 00000000..fcf94d69 --- /dev/null +++ b/libexec/rbenv---version @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -e +[ -n "$RBENV_DEBUG" ] && set -x + +version=v0.3.0 + +cd "$RBENV_ROOT" +git_revision="$(git describe --tags HEAD 2>/dev/null || true)" + +echo ${git_revision:-$version}