Update blog script, add new note script.

This commit is contained in:
CronyAkatsuki 2024-03-29 12:47:04 +01:00
parent 7c81981aac
commit 44f00b4169
3 changed files with 61 additions and 10 deletions

View File

@ -0,0 +1,13 @@
{ pkgs, ... }:
with pkgs;
rustPlatform.buildRustProgram rec {
pname = "comet-gog";
version = "e313c8a";
src = fetchFromGitHub {
owner = "imLinguin";
repo = "comet";
rev = "e313c8ae052dfd9a6b06c8246f83f5f34672bcaa";
hash = "sha256-p4fDm2XdqAOBZTNuw8S29vj5U21t4eeHjtKiK6tN0AM=";
};
cargoLock.lockFile = ./Cargo.lock;
}

View File

@ -10,11 +10,11 @@ fi
open_file() { open_file() {
cd "$HOME"/Documents/repos/cronyakatsuki.xyz || exit 1 cd "$HOME"/Documents/repos/cronyakatsuki.xyz || exit 1
if [ -f "content/blog/${1}" ]; then if [ -f "content/blog/${1}.md" ]; then
nvim "content/blog/${1}" nvim "content/blog/${1}.md"
else else
hugo new "content/blog/${1}" hugo new "content/blog/${1}.md"
nvim "content/blog/${1}" nvim "content/blog/${1}.md"
fi fi
} }
@ -29,8 +29,8 @@ publish() {
remove_file() { remove_file() {
cd "$HOME"/Documents/repos/cronyakatsuki.xyz || exit 1 cd "$HOME"/Documents/repos/cronyakatsuki.xyz || exit 1
if [ -f "content/blog/${1}" ]; then if [ -f "content/blog/${1}.md" ]; then
rm "content/blog/${1}" rm "content/blog/${1}.md"
else else
echo "File didn't exist" echo "File didn't exist"
fi fi
@ -39,16 +39,15 @@ remove_file() {
if [ "$1" = "pub" ]; then if [ "$1" = "pub" ]; then
publish publish
exit 0 exit 0
elif [ $# -eq 1 ]; then
open_file "$1"
exit 0
elif [ $# -ne 2 ]; then elif [ $# -ne 2 ]; then
echo "You need to provide action and file name." echo "You need to provide action and file name."
exit 1 exit 1
fi fi
case "$1" in case "$1" in
edit)
open_file "$2"
exit 0
;;
rm) rm)
remove_file "$2" remove_file "$2"
exit 0 exit 0

View File

@ -0,0 +1,39 @@
#!/usr/bin/env sh
if [ $# -eq 0 ]; then
cd "$SECOND_BRAIN"/notes || exit 1
nvim
exit 0
fi
open_file() {
cd "$SECOND_BRAIN"/notes || exit 1
nvim "${1}.md"
}
remove_file() {
cd "$SECOND_BRAIN"/notes || 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