mirror of
https://github.com/ViViDboarder/shoestrap.git
synced 2024-12-27 08:27:42 +00:00
47 lines
692 B
Plaintext
47 lines
692 B
Plaintext
|
#! /bin/bash
|
||
|
|
||
|
NOTES_DIR="$HOME/Nextcloud/Notes"
|
||
|
|
||
|
function usage() {
|
||
|
echo "nnotes expects 0, 1, or 2 arguments"
|
||
|
}
|
||
|
|
||
|
function validate() {
|
||
|
if [ ! -d "$NOTES_DIR" ]; then
|
||
|
echo "No directory $NOTES_DIR. Please sync your notes"
|
||
|
exit 1
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
function main() {
|
||
|
validate
|
||
|
|
||
|
# nvim "$NOTES_DIR" -c ":cd $NOTES_DIR"
|
||
|
cd $NOTES_DIR
|
||
|
|
||
|
mkdir -p $CATEGORY
|
||
|
nvim $CATEGORY/$FILE.md
|
||
|
}
|
||
|
|
||
|
case $# in
|
||
|
0)
|
||
|
CATEGORY=.
|
||
|
FILE=.
|
||
|
;;
|
||
|
1)
|
||
|
CATEGORY=.
|
||
|
FILE="$1"
|
||
|
;;
|
||
|
2)
|
||
|
CATEGORY="$1"
|
||
|
FILE="$2"
|
||
|
;;
|
||
|
*)
|
||
|
echo "Unknown number of arugments"
|
||
|
usage
|
||
|
exit 1
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
main $*
|