Show enabled sources
This commit is contained in:
parent
cc0003592b
commit
0a52f2201f
@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# If not running interactively, don't do anything
|
||||
case $- in
|
||||
*i*) ;;
|
||||
@ -90,10 +92,6 @@ function __download {
|
||||
fi
|
||||
}
|
||||
|
||||
function _indent {
|
||||
xargs -n1 printf ' %s\n'
|
||||
}
|
||||
|
||||
function rbash_cache {
|
||||
local CACHE_FILE
|
||||
MLINK=$( echo "$1" | md5sum | cut -d' ' -f1 )
|
||||
@ -111,7 +109,7 @@ function rbash_cache {
|
||||
# User specific aliases and functions
|
||||
function rbash_load {
|
||||
local f path
|
||||
echo "$1" | _indent
|
||||
echo " $1"
|
||||
f=`rbash_cache "$RBASH_REMOTE/$RBASH_REPO/raw/branch/master/$RBASH_PATH/$1"`
|
||||
source "$f"
|
||||
}
|
||||
@ -163,14 +161,30 @@ function rbash-run {
|
||||
"$f" "$@"
|
||||
}
|
||||
|
||||
function rbash-list {
|
||||
function _require_jq {
|
||||
which jq 2>&1 > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo This command requires jq.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function rbash-list {
|
||||
_require_jq || return 1
|
||||
echo "Available sources:"
|
||||
__download "$RBASH_REMOTE/api/v1/repos/$RBASH_REPO/contents/$RBASH_PATH/sources/" | jq -r '.[].name' | _indent
|
||||
for i in `__download "$RBASH_REMOTE/api/v1/repos/$RBASH_REPO/contents/$RBASH_PATH/sources/" | jq -r '.[].name'`; do
|
||||
grep -q -e "^rbash_load \"sources/$i\"\$" "$RBASH_CONFIG"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo " * $i"
|
||||
else
|
||||
echo " $i"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function rbash-enable {
|
||||
_require_jq || return 1
|
||||
|
||||
}
|
||||
|
||||
export PS1='This is <MACHINE_NAME>\e[1;3<COLOR_CODE>m<MACHINE_COLORED_NAME>\e[0m: \w\n\$ '
|
||||
|
Loading…
Reference in New Issue
Block a user