Last active
October 23, 2018 02:40
-
-
Save photonxp/cfba9d07b9f5ff89c3b19f8705c471a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment