oh-my-zsh/plugins/org-mode-manager/_org

42 lines
958 B
Plaintext
Raw Normal View History

2017-08-27 01:57:08 +00:00
#compdef org
_org(){
local state
local f_dirname=~/.config/org_notes.location
2017-08-27 01:57:08 +00:00
touch $f_dirname
local f_dir=$(cat $f_dirname)
if [ "$f_dir" = "" ]; then
echo -e "-> No location set in $f_dirname"
return -1
fi
local f_dir=$(readlink -f $f_dir)
_arguments \
'1: :->org_files'\
'*: :->args'
### Attempt to make org print out everything at a subdirectory by tabbing a suggestion, one subdir (depth 1) at a time
#local dirs_at_loc=$(find ${f_dir} -maxdepth 1 -type d);
#local files_at_loc=$(find ${f_dir} -type f -name '*.org' | sed "s|^${f_dir}/||" | sed "s|.org$||")
#case $state in
# (org_files)
# _arguments "1:files:($files_at_loc $dirs_at_loc)";
# org --subdir=${org_files}
# return 0
# ;;
#esac
local all=$(find ${f_dir} -type f -name '*.org' | sed "s|^${f_dir}/||" | sed "s|.org$||")
2017-08-27 01:57:08 +00:00
case $state in
(org_files) _arguments "1:files:($all)" ;;
esac
2017-08-27 01:57:08 +00:00
}
_org "$@"