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
|
# If not running interactively, don't do anything
|
||||||
case $- in
|
case $- in
|
||||||
*i*) ;;
|
*i*) ;;
|
||||||
@ -90,10 +92,6 @@ function __download {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function _indent {
|
|
||||||
xargs -n1 printf ' %s\n'
|
|
||||||
}
|
|
||||||
|
|
||||||
function rbash_cache {
|
function rbash_cache {
|
||||||
local CACHE_FILE
|
local CACHE_FILE
|
||||||
MLINK=$( echo "$1" | md5sum | cut -d' ' -f1 )
|
MLINK=$( echo "$1" | md5sum | cut -d' ' -f1 )
|
||||||
@ -111,7 +109,7 @@ function rbash_cache {
|
|||||||
# User specific aliases and functions
|
# User specific aliases and functions
|
||||||
function rbash_load {
|
function rbash_load {
|
||||||
local f path
|
local f path
|
||||||
echo "$1" | _indent
|
echo " $1"
|
||||||
f=`rbash_cache "$RBASH_REMOTE/$RBASH_REPO/raw/branch/master/$RBASH_PATH/$1"`
|
f=`rbash_cache "$RBASH_REMOTE/$RBASH_REPO/raw/branch/master/$RBASH_PATH/$1"`
|
||||||
source "$f"
|
source "$f"
|
||||||
}
|
}
|
||||||
@ -163,14 +161,30 @@ function rbash-run {
|
|||||||
"$f" "$@"
|
"$f" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
function rbash-list {
|
function _require_jq {
|
||||||
which jq 2>&1 > /dev/null
|
which jq 2>&1 > /dev/null
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo This command requires jq.
|
echo This command requires jq.
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function rbash-list {
|
||||||
|
_require_jq || return 1
|
||||||
echo "Available sources:"
|
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\$ '
|
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