Sha256: 697f28da194751e87ea74804ffd6e0e1df1a183920167fc9ebafe3c0c743c10d
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
#!/usr/bin/env bash add(){ token="$1" eval "${token}_flag=1" ; shift if [[ ! -z "$format" ]] ; then format="${format}-\$${token}" else format="\$${token}" fi } if which ruby 2>/dev/null | grep -q 'rvm' ; then unset format while [[ $# -gt 0 ]] ; do token="$1" ; shift case "$token" in i|interpreter) add "interpreter" ;; v|version) add "version" ;; p|patchlevel) add "patchlevel" ;; r|revision) add "revision" ;; a|architecture) add "architecture" ;; *) echo "Unrecognized command line option '$token' for $0" ; exit 1 ;; esac done if [[ -z "$format" ]] ; then add "interpreter" add "version" add "patchlevel" fi ruby_string=$(dirname "$(which ruby 2>/dev/null)" | xargs dirname | xargs basename) (( $interpreter_flag )) && interpreter="$(echo $ruby_string | awk -F'-' '{print $1}')" (( $version_flag )) && version="$(echo $ruby_string | awk -F'-' '{print $2}')" (( $patchlevel_flag )) && patchlevel=$(echo $ruby_string | awk -F'-' '{print $3}') (( $architecture_flag )) && architecture="$(echo "$(ruby -v)" | sed 's/^.*\[//' | sed 's/\].*$//')" command="prompt=\"[$format]\"" eval "$command" echo "${prompt/-]/]}" fi exit 0
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rvm-0.0.97 | binscripts/rvm-prompt |