diff --git a/notestorm b/notestorm index b84b786..003413b 100755 --- a/notestorm +++ b/notestorm @@ -188,6 +188,21 @@ encrypt_note() { infobox "$(gettext "Encryption failed.")" } +original_note() { + # If no notes are present this will try to copy the README.md file into the notes directory so the menu won't fail. + mapfile -t notes < <(find "$xdgPath/notestorm/notes" -type f -iname '*.md' -o -iname '*.gpg') + if [[ "${#notes[@]}" -gt 0 ]]; then + return + fi + if [[ -f "README.md" ]]; then + cp "README.md" "${xdgPath}/notestorm/notes/README.md" + elif [[ -f "/usr/share/doc/notestorm/README.md" ]]; then + cp "README.md" "${xdgPath}/notestorm/notes/README.md" + else + echo "The README file is missing. Pleae visit the notestorm git page for usage information." > "${xdgPath}/notestorm/notes/README.md" + fi +} + # Configuration section # Available arguments in both long and short versions stored in associative array. declare -A argList=( @@ -210,8 +225,9 @@ else pager="${PAGER:-more}" fi xdgPath="${XDG_CONFIG_HOME:-$HOME/.config}" -#set up the notes directory +# set up the notes directory mkdir -p "${xdgPath}/notestorm/notes" +original_note # Keep track of the number of arguments passed to the program. argNum=$# # Settings to improve accessibility of dialog.