Check if snippet dir exists and create first snippet

This commit is contained in:
BarbUk 2020-03-09 17:09:50 +04:00
parent 59fa862a8f
commit 68344d6643

11
snippy
View File

@ -136,6 +136,15 @@ move_cursor() {
fi fi
} }
init() {
# Check
if [[ ! -d "$snippets_directory" ]]; then
mkdir -p "$snippets_directory"
echo "$snippets_directory created"
echo "hi it is \$(date)" > "$snippets_directory/test"
fi
}
run() { run() {
cd "${snippets_directory}" || exit cd "${snippets_directory}" || exit
@ -267,4 +276,4 @@ run() {
echo -ne "$current_clipboard" | xsel --clipboard --input echo -ne "$current_clipboard" | xsel --clipboard --input
} }
run init && run