Major chhanges: daisy.source renamed to ld.source.
All files have been prettified by making sure we use 2-space indent. agenda: Instead of the hidden .tree file, a file created "More..." is made. You can use (ex) "agenda --view "2026" to get a full list of files from that year/date/day. Additionally, minor fixes have been made. clip: You can now use "-c" to clear the clipbaord.
This commit is contained in:
parent
056ab01ed4
commit
ab730db2f7
14 changed files with 264 additions and 534 deletions
|
|
@ -40,17 +40,20 @@ _daisy_enc()
|
|||
fi
|
||||
|
||||
if [ -n "$1" ] && [ -d "$1" ]; then
|
||||
echo -e "daisy_create_folder=$1"
|
||||
printf "daisy_create_folder=%s\n" "$1"
|
||||
else
|
||||
local file_dir=""
|
||||
local file_dir="."
|
||||
local file_name=""
|
||||
local perms=755
|
||||
local input_source="/dev/stdin"
|
||||
local target=$1
|
||||
|
||||
if [[ ! -t 0 ]] && [[ $enc_is_folder == 0 ]]; then
|
||||
input_source="$1"
|
||||
file_dir="."
|
||||
file_name="$1"
|
||||
elif [ -f "$1" ]; then
|
||||
input_source="$1"
|
||||
file_dir=$(dirname "$1")
|
||||
file_name=$(basename "$1")
|
||||
perms=$(stat -c %a "$1")
|
||||
|
|
@ -60,10 +63,10 @@ _daisy_enc()
|
|||
fi
|
||||
|
||||
local base64_inner
|
||||
base64_inner=$(cat "${1:-/dev/stdin}" | base64 | tr -d '\n')
|
||||
echo -e "daisy_folder_$file_name=$file_dir"
|
||||
echo -e "daisy_data_base64_$file_name=\"$base64_inner\""
|
||||
echo -e "daisy_perms_$file_name=$perms"
|
||||
base64_inner=$(cat "${input_source:-/dev/stdin}" | base64 | tr -d '\n')
|
||||
printf "daisy_folder_%s=%s\n" "$file_name" "$file_dir"
|
||||
printf "daisy_data_base64_%s=\"%s\"\n" "$file_name" "$base64_inner"
|
||||
printf "daisy_perms_%s=%s\n" "$file_name" "$perms"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -73,16 +76,15 @@ _daisy_dec()
|
|||
echo "$0: No arguments or stdin specified!"
|
||||
return 1
|
||||
fi
|
||||
local data
|
||||
data=$(cat "${1:-/dev/stdin}" | grep -v "#")
|
||||
echo -e "$data" | cut -d "=" -f 2- | cut -b 2- | head -c -2 | base64 -d
|
||||
sed -n "s/^daisy_data_base64_.*=\"\(.*\)\"$/\1/p" "${1:-/dev/stdin}" | base64 -d
|
||||
}
|
||||
|
||||
_daisy_unalias()
|
||||
{
|
||||
local unalias_param="$1"
|
||||
if [[ $unalias_param =~ ^[0-9]+$ ]]; then
|
||||
unalias_param=$(head -"$unalias_param" "$LD_ALIASFILE" 2>/dev/null | tail -1 | cut -d "=" -f 1 | awk '{print $2}')
|
||||
unalias_param=$(head -"$unalias_param" "$LD_ALIASFILE" 2>/dev/null | \
|
||||
tail -1 | cut -d "=" -f 1 | awk '{print $2}')
|
||||
fi
|
||||
if [[ -z "$unalias_param" ]]; then
|
||||
return
|
||||
|
|
@ -117,49 +119,49 @@ cmd_help()
|
|||
|
||||
# Match lines defining tools (e.g., "< cdz >" or "< daisy welcome >")
|
||||
$0 ~ /^[[:space:]]*< .* >/ {
|
||||
printing=0 # Stop printing previous tool
|
||||
printing=0 # Stop printing previous tool
|
||||
|
||||
# Clean the line to get the "signature"
|
||||
# "< daisy welcome >" becomes "daisy welcome"
|
||||
sig = $0
|
||||
sub(/^[[:space:]]*< /, "", sig)
|
||||
sub(/ >[[:space:]]*$/, "", sig)
|
||||
# Clean the line to get the "signature"
|
||||
# "< daisy welcome >" becomes "daisy welcome"
|
||||
sig = $0
|
||||
sub(/^[[:space:]]*< /, "", sig)
|
||||
sub(/ >[[:space:]]*$/, "", sig)
|
||||
|
||||
# Check for exact match OR match within a slash/space-separated list
|
||||
split(sig, names, "[ /]")
|
||||
# Check for exact match OR match within a slash/space-separated list
|
||||
split(sig, names, "[ /]")
|
||||
|
||||
is_match = 0
|
||||
if (sig == query) is_match = 1
|
||||
else {
|
||||
for (i in names)
|
||||
{
|
||||
if (names[i] == query)
|
||||
{ is_match = 1; break }
|
||||
}
|
||||
}
|
||||
is_match = 0
|
||||
if (sig == query) is_match = 1
|
||||
else {
|
||||
for (i in names)
|
||||
{
|
||||
if (names[i] == query)
|
||||
{ is_match = 1; break }
|
||||
}
|
||||
}
|
||||
|
||||
if (is_match)
|
||||
{
|
||||
printing=1
|
||||
found=1
|
||||
print $0
|
||||
next
|
||||
}
|
||||
if (is_match)
|
||||
{
|
||||
printing=1
|
||||
found=1
|
||||
print $0
|
||||
next
|
||||
}
|
||||
}
|
||||
|
||||
# Print description lines if we are in a "found" block
|
||||
printing {
|
||||
# Stop if we hit the start of the NEXT tool
|
||||
if ($0 ~ /^[[:space:]]*< /)
|
||||
{ printing=0; next }
|
||||
print
|
||||
# Stop if we hit the start of the NEXT tool
|
||||
if ($0 ~ /^[[:space:]]*< /)
|
||||
{ printing=0; next }
|
||||
print
|
||||
}
|
||||
|
||||
END {
|
||||
if (found == 0)
|
||||
{
|
||||
print "Tool '"'"'" query "'"'"' not found in README.md."
|
||||
}
|
||||
if (found == 0)
|
||||
{
|
||||
print "Tool '"'"'" query "'"'"' not found in README.md."
|
||||
}
|
||||
}
|
||||
'
|
||||
fi
|
||||
|
|
@ -176,9 +178,9 @@ cmd_list()
|
|||
sed -n '/--- BEGIN OF DAISY HELP ---/,/--- END OF DAISY HELP ---/{//!p;}' "$file" |
|
||||
awk '
|
||||
/^[[:space:]]*< / {
|
||||
sub(/^[[:space:]]*< /, "");
|
||||
sub(/ >[[:space:]]*$/, "");
|
||||
print " " $0
|
||||
sub(/^[[:space:]]*< /, "");
|
||||
sub(/ >[[:space:]]*$/, "");
|
||||
print " " $0
|
||||
}
|
||||
' | sort
|
||||
}
|
||||
|
|
@ -220,8 +222,8 @@ cmd_dec()
|
|||
local arg1=$1
|
||||
local arg2=$2
|
||||
if [ ! -t 0 ]; then
|
||||
arg2=$1
|
||||
arg1=/dev/stdin
|
||||
arg2=$1
|
||||
arg1=/dev/stdin
|
||||
fi
|
||||
[[ -t 0 ]] && [[ ! -f "$arg1" ]] && echo "daisy dec multi: No input file specified" && exit 1
|
||||
[[ ! -d "$arg2" ]] && echo "daisy dec multi: No output directory specified" && exit 1
|
||||
|
|
@ -258,9 +260,9 @@ cmd_alias()
|
|||
local linenum=1
|
||||
if [[ -f "$LD_ALIASFILE" ]]; then
|
||||
while IFS= read -r line; do
|
||||
line=$(echo "$line" | sed 's/alias //g')
|
||||
echo "$linenum: $line"
|
||||
((linenum++))
|
||||
line=$(echo "$line" | sed 's/alias //g')
|
||||
echo "$linenum: $line"
|
||||
((linenum++))
|
||||
done < "$LD_ALIASFILE"
|
||||
fi
|
||||
else
|
||||
|
|
@ -321,7 +323,7 @@ cmd_check()
|
|||
check_bin sed "Stream editing"
|
||||
check_bin grep "Pattern matching"
|
||||
check_bin base64 "Data encoding"
|
||||
check_bin realpath "Path resolution"
|
||||
check_bin realpath "Path resolution"
|
||||
|
||||
echo -e "\n--- Enhanced UI & Navigation ---"
|
||||
check_bin fzf "Used by cdf"
|
||||
|
|
@ -398,9 +400,13 @@ daisy ()
|
|||
dec) shift; cmd_dec "$@" ;;
|
||||
alias) shift; cmd_alias "$@" ;;
|
||||
unalias) shift; _daisy_unalias "$@" ;;
|
||||
backup) shift; find "$LD_CONFIG_FOLDER" -name "*.src" -type f | while read -r f; do cp -R "$f" "$f.bak"; echo "Backup made: $f --> $f.bak"; done ;;
|
||||
backup) shift; find "$LD_CONFIG_FOLDER" -name "*.src" -type f | \
|
||||
while read -r f; do \
|
||||
cp -R "$f" "$f.bak"; \
|
||||
echo "Backup made: $f --> $f.bak";
|
||||
done ;;
|
||||
clear) shift; cmd_clear ;;
|
||||
check) shift; cmd_check ;;
|
||||
check) shift; cmd_check ;;
|
||||
restore) shift; cmd_restore ;;
|
||||
combine) shift; cmd_combine ;;
|
||||
editor) shift; cmd_editor "$@" ;;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue