From cc0003592b67472193059b050469886a220d9905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Thu, 11 Aug 2022 21:19:17 +0800 Subject: [PATCH] Proper rbash-list --- bash/bashrc/rbashrc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bash/bashrc/rbashrc b/bash/bashrc/rbashrc index d30c016..89763d0 100644 --- a/bash/bashrc/rbashrc +++ b/bash/bashrc/rbashrc @@ -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 \e[1;3m\e[0m: \w\n\$ '