penguin/utils

my env utils

commit cc0003592b67472193059b050469886a220d9905

author斟酌 鵬兄 <tgckpg@gmail.com>
date2022-08-11T13:19:17Z
subjectProper rbash-list
commit cc0003592b67472193059b050469886a220d9905
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2022-08-11T13:19:17Z

    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 <MACHINE_NAME>\e[1;3<COLOR_CODE>m<MACHINE_COLORED_NAME>\e[0m: \w\n\$ '