Update scripts.
This commit is contained in:
parent
9eb0fa22a9
commit
614e626902
12 changed files with 201 additions and 101 deletions
39
pblog
Executable file
39
pblog
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
cd "$SECOND_BRAIN"/blog || exit 1
|
||||
nvim .
|
||||
exit 0
|
||||
fi
|
||||
|
||||
open_file() {
|
||||
cd "$SECOND_BRAIN"/blog || exit 1
|
||||
nvim "${1}.md"
|
||||
}
|
||||
|
||||
remove_file() {
|
||||
cd "$SECOND_BRAIN"/blog || exit 1
|
||||
if [ -f "${1}.md" ]; then
|
||||
rm "${1}.md"
|
||||
else
|
||||
echo "File didn't exist"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# -eq 1 ]; then
|
||||
open_file "$1"
|
||||
exit 0
|
||||
elif [ $# -ne 2 ]; then
|
||||
echo "You need to provide action and file name."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
rm)
|
||||
remove_file "$2"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Loading…
Add table
Add a link
Reference in a new issue