feat: Refactored note into a rust binary
This commit is contained in:
parent
ad6bc12aa3
commit
96e7c9dc5e
67
.profile
67
.profile
@ -190,73 +190,6 @@ DAP-Python-Gen() {
|
||||
__EOF__
|
||||
}
|
||||
|
||||
Note() {
|
||||
local invoked_dir
|
||||
invoked_dir="$(pwd)"
|
||||
|
||||
mkdir -p "${NOTES_DIR}"
|
||||
|
||||
if [ -z "${1}" ]; then
|
||||
printf "%s\n" "No note provided!" 1>&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
local note_selection
|
||||
note_selection="${NOTES_DIR}/${2}.norg"
|
||||
|
||||
local note_bare
|
||||
note_bare="${2}"
|
||||
|
||||
local selection
|
||||
selection="${1}"
|
||||
|
||||
local option_selected
|
||||
option_selected=1
|
||||
while ((option_selected != 0)); do
|
||||
case "${selection}" in
|
||||
--open | -o)
|
||||
if [[ -z "${note_bare}" ]]; then
|
||||
echo_rgb "No note selection provided!" 255 0 0 25 0 0
|
||||
return 1
|
||||
fi
|
||||
cd "${NOTES_DIR}"
|
||||
nvim "${note_selection}"
|
||||
cd "${invoked_dir}"
|
||||
option_selected=0
|
||||
;;
|
||||
--delete | -d)
|
||||
if [[ -z "${*:2}" ]]; then
|
||||
echo_rgb "No note selection provided!" 255 0 0 25 0 0 1>&2
|
||||
return 1
|
||||
fi
|
||||
local exit_code
|
||||
exit_code=0
|
||||
for note in "${@:2}"; do
|
||||
note_selection="${NOTES_DIR}/${note}.norg"
|
||||
if [[ ! -r "${note_selection}" ]]; then
|
||||
echo_rgb "Could not delete \"${note}\", does it exist?" 255 0 0 25 0 0 1>&2
|
||||
exit_code=1
|
||||
fi
|
||||
rm -f "${note_selection}"
|
||||
done
|
||||
option_selected=0
|
||||
return "${exit_code}"
|
||||
;;
|
||||
--list | -l)
|
||||
for note in "${NOTES_DIR}/"*.norg; do
|
||||
echo_rgb "${note}" 64 143 255 11 22 36
|
||||
done
|
||||
option_selected=0
|
||||
;;
|
||||
*)
|
||||
selection="--open"
|
||||
note_selection="${NOTES_DIR}/${1}.norg"
|
||||
note_bare="${1}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
TCPDump-Capture() {
|
||||
tcpdump -qns 0 -X -r "${1}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user