Proper rbash-list

This commit is contained in:
斟酌 鵬兄 2022-08-11 21:19:17 +08:00
parent f3587b063b
commit cc0003592b

View File

@ -90,6 +90,10 @@ function __download {
fi
}
function _indent {
xargs -n1 printf ' %s\n'
}
function rbash_cache {
local CACHE_FILE
MLINK=$( echo "$1" | md5sum | cut -d' ' -f1 )
@ -107,7 +111,7 @@ function rbash_cache {
# User specific aliases and functions
function rbash_load {
local f path
echo " $1"
echo "$1" | _indent
f=`rbash_cache "$RBASH_REMOTE/$RBASH_REPO/raw/branch/master/$RBASH_PATH/$1"`
source "$f"
}
@ -165,8 +169,8 @@ function rbash-list {
echo This command requires jq.
return 1
fi
__download "$RBASH_REMOTE/api/v1/repos/$RBASH_REPO/$RBASH_PATH/sources/" | jq -r '.[].name'
echo "Available sources:"
__download "$RBASH_REMOTE/api/v1/repos/$RBASH_REPO/contents/$RBASH_PATH/sources/" | jq -r '.[].name' | _indent
}
export PS1='This is <MACHINE_NAME>\e[1;3<COLOR_CODE>m<MACHINE_COLORED_NAME>\e[0m: \w\n\$ '