-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
help
executable file
·68 lines (53 loc) · 1.42 KB
/
help
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
rvm_base_except="selector"
source "$rvm_scripts_path/base"
# check longest paths first
__rvm_help_find()
{
typeset _full_name
typeset -a _full_paths
_full_name=""
_full_paths=()
_matched=""
# start with shortest, build path and prepend it to beginning
while (( $# > 0 ))
do
_full_name="${_full_name:-}${1:-}"
_full_paths=( "${_full_name}" "${_full_paths[@]}" )
_full_name="${_full_name:-}_/"
shift
done
for _full_name in "${_full_paths[@]}"
do
if
[[ -n "${_full_name}" && -s "${rvm_help_path}/${_full_name}" ]]
then
echo "${rvm_help_path}/${_full_name}"
return 0
fi
done
return 1
}
__rvm_help()
{
typeset _matched
if
_matched="$(__rvm_help_find "$@")"
then
__rvm_pager_or_cat_v "${_matched}"
else
[[ -z "$1" ]] || rvm_error "Documentation for 'rvm $*' not found"
cat "${rvm_path:-$HOME/.rvm}/README" | sed '1,2d' | __rvm_pager_or_cat_v -
rvm_log "
Commands available with 'rvm help':
$(chpwd_functions="" builtin cd "${rvm_help_path}" ; find . -maxdepth 1 -mindepth 1 -type f -print | \tr "\n" ' ' | sed -e 's#./##g')
"
fi
rvm_log "
For additional information please visit RVM's documentation website:
https://rvm.io/
If you still cannot find what an answer to your question, find me 'wayneeseguin' in #rvm on irc.freenode.net:
http://webchat.freenode.net/?channels=rvm
"
}
__rvm_help "$@"