作者:橡树NO洋_640 | 来源:互联网 | 2023-08-25 19:50
本文由编程笔记#小编为大家整理,主要介绍了sh import_qnotes.bash相关的知识,希望对你有一定的参考价值。
#!/bin/bash
import_note_by_fpath_data(){
import_note_tag_by_fpath_data(){
get_note_taglist_by_fpath_data(){
line_tag=$(grep -m 1 '^tag::' "$fpath_data")
taglist="$(echo ${line_tag##*:})"
}
fpath_data="$1"
fname_data="${fpath_data##*/}"
fname_jnote="${fname_data%.md}"
get_note_taglist_by_fpath_data
if [ "y" == "y$taglist" ]
then
return
fi
for tag in $taglist
do
$joplin_prfl tag add $tag "$fname_jnote"
done
}
import_note_body_by_fpath_data(){
$joplin_prfl import "$fpath_data" bk9 -f --format md
}
fpath_data="$1"
#echo "$fname_jnote"
joplin_prfl="joplin-terminal"
import_note_body_by_fpath_data "$fpath_data"
import_note_tag_by_fpath_data "$fpath_data"
}
main(){
dpath_data="$1"
mapfile -t arr_fpathlist <<(find "$dpath_data" -maxdepth 1 -type f)
for fpath in "${arr_fpathlist[@]}"
do
import_note_by_fpath_data "$fpath"
done
}
main "$@"