Dot_Files/.zsh/completions/_Note
2022-04-15 14:38:17 -05:00

27 lines
689 B
Plaintext

#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]'
{--help,-h}'[Show help menu]'
{--version,-V}'[Show program version]'
"${file_name_comp}"
)
_arguments -S -s $args
}
if (( ${#words} == 2 )); then
_Note_command
elif (( ${#words} == 3)); then
_arguments "${file_name_comp}"
elif (( ${#words} > 3 )) && [[ ${words[2]} = "--delete" || ${words[2]} = "-d" ]]; then
_arguments "${file_name_comp}"
fi