2022-01-14 12:02:52 -06:00
|
|
|
#compdef Note
|
|
|
|
|
|
|
|
local file_name_comp='*: :_files -W ${NOTES_DIR} -g "*.norg(:r)" -S " "'
|
|
|
|
|
|
|
|
(( $+functions[_Note_subcommand] )) ||
|
|
|
|
_Note_command() {
|
|
|
|
local -a args
|
|
|
|
args=(
|
|
|
|
{--open,-o}'[Create or edit a note]'
|
|
|
|
{--delete,-d}'[Delete a note]'
|
|
|
|
{--list,-l}'[List all notes]'
|
|
|
|
"${file_name_comp}"
|
|
|
|
)
|
|
|
|
|
|
|
|
_arguments -S -s $args
|
|
|
|
}
|
|
|
|
|
|
|
|
if (( ${#words} == 2 )); then
|
|
|
|
_Note_command
|
|
|
|
elif (( ${#words} == 3)); then
|
|
|
|
_arguments "${file_name_comp}"
|
2022-02-01 15:21:25 -06:00
|
|
|
elif (( ${#words} > 3 )) && [[ ${words[2]} = "--delete" || ${words[2]} = "-d" ]]; then
|
|
|
|
_arguments "${file_name_comp}"
|
2022-01-14 12:02:52 -06:00
|
|
|
fi
|