feat(user/malte): hyprlinks/backlog/pagination in note command
This commit is contained in:
parent
a431253613
commit
e5eae8c827
|
@ -51,6 +51,8 @@ function print_help_and_exit() {
|
|||
printf " Execute a git command in the note repository\n"
|
||||
printf " dir\n"
|
||||
printf " Print the note directory\n"
|
||||
printf " log\n"
|
||||
printf " Print the entire note file\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -101,6 +103,9 @@ while [[ $# -gt 0 ]]; do
|
|||
echo "$XDG_DATA_HOME/life.md"
|
||||
exit
|
||||
;;
|
||||
log)
|
||||
shift
|
||||
;;
|
||||
-h | --help)
|
||||
print_help_and_exit
|
||||
;;
|
||||
|
@ -138,6 +143,7 @@ bat "$XDG_DATA_HOME/life.md/$year.md" |
|
|||
cat
|
||||
fi
|
||||
} |
|
||||
sed $'s|\[\([^]]\+\)\](\(https\\?://[^)]\+\))|\e[34;3;4m\e]8;;\\2\e\\\\\\1\x1b[0m\e]8;;\e\\\\|g' |
|
||||
sed "s/^# \([[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}\)/ $C_HEADLINE \1 $C_RESET\n/" |
|
||||
sed "s/^## \(.*\)\$/ $C_SUBHEADING\1$C_RESET\n/" |
|
||||
sed "s/- \[ \] \([[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}\) /- [ ] $C_DEADLINE \1$C_RESET/" |
|
||||
|
@ -149,4 +155,18 @@ bat "$XDG_DATA_HOME/life.md/$year.md" |
|
|||
sed "s/\([[:digit:]]\{2\}:[[:digit:]]\{2\}\)/$C_TIME\1$C_RESET/g" |
|
||||
sed "s/\(#\S\+\)/$C_CYAN\1$C_RESET/g" |
|
||||
sed "s/\(\(due\|done\|prio\|closed\):\S\+\)/$C_MAGENTA\1$C_RESET/g" |
|
||||
sed "s/^---\$/$C_MAGENTA$DASH$C_RESET/"
|
||||
sed "s/^---\$/$C_MAGENTA$DASH$C_RESET/" |
|
||||
{
|
||||
input=$(cat)
|
||||
max_length=$(tput lines) # Terminal height
|
||||
# Measure the length of the input
|
||||
input_length=$(echo "$input" | wc -l)
|
||||
# Compare the input length with the maximum allowed length
|
||||
if ((input_length > max_length)); then
|
||||
# Input exceeds maximum length - use an external pager like 'less'
|
||||
echo "$input" | less -r
|
||||
else
|
||||
# Input does not exceed the maximum length - print directly
|
||||
echo "$input"
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue