Reworked print function
This commit is contained in:
@@ -1,31 +1,8 @@
|
||||
function list(){
|
||||
if [ -d "$BASE_DIR"/"$NOTEBOOK" ]; then
|
||||
printf "\nNotes in %s:\n" "$(basename "$NOTEBOOK")"
|
||||
|
||||
NOTES=(
|
||||
$(find "$BASE_DIR"/"$NOTEBOOK" -name "*.$EXT" -print0 |\
|
||||
sed s:"$BASE_DIR"/"$NOTEBOOK"/: " " :g |\
|
||||
sed -e s:".$EXT"::g | tr "/" " ")
|
||||
)
|
||||
let i=0
|
||||
for NOTE in "${NOTES[@]}"; do
|
||||
if [ -d "$BASE_DIR"/"$NOTEBOOK"/"$NOTE" ]; then
|
||||
if [ "$LAST_SECTION" != "$NOTE" ]; then
|
||||
printf " Section: %s\n" "$NOTE"
|
||||
fi
|
||||
LAST_SECTION="$NOTE"
|
||||
else
|
||||
#if [ $(($i % 1)) -eq 0 ]; then
|
||||
# printf "\n "
|
||||
#fi
|
||||
printf " %s\n" "$NOTE"
|
||||
fi
|
||||
let i++
|
||||
printf "+%s\n" "$NOTEBOOK"
|
||||
find "$BASE_DIR"/"$NOTEBOOK" -type f | while read NOTE; do
|
||||
printf " -%s\n" "$(basename $NOTE | cut -d . -f 1)"
|
||||
done
|
||||
printf "\n"
|
||||
else
|
||||
echo ""
|
||||
echo "ERROR: Notebook $NOTEBOOK does not exist."
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user