Update blog script, add new note script.
This commit is contained in:
parent
7c81981aac
commit
44f00b4169
13
home-manager/modules/comet-gog.nix
Normal file
13
home-manager/modules/comet-gog.nix
Normal 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;
|
||||
}
|
@ -10,11 +10,11 @@ fi
|
||||
|
||||
open_file() {
|
||||
cd "$HOME"/Documents/repos/cronyakatsuki.xyz || exit 1
|
||||
if [ -f "content/blog/${1}" ]; then
|
||||
nvim "content/blog/${1}"
|
||||
if [ -f "content/blog/${1}.md" ]; then
|
||||
nvim "content/blog/${1}.md"
|
||||
else
|
||||
hugo new "content/blog/${1}"
|
||||
nvim "content/blog/${1}"
|
||||
hugo new "content/blog/${1}.md"
|
||||
nvim "content/blog/${1}.md"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ publish() {
|
||||
|
||||
remove_file() {
|
||||
cd "$HOME"/Documents/repos/cronyakatsuki.xyz || exit 1
|
||||
if [ -f "content/blog/${1}" ]; then
|
||||
rm "content/blog/${1}"
|
||||
if [ -f "content/blog/${1}.md" ]; then
|
||||
rm "content/blog/${1}.md"
|
||||
else
|
||||
echo "File didn't exist"
|
||||
fi
|
||||
@ -39,16 +39,15 @@ remove_file() {
|
||||
if [ "$1" = "pub" ]; then
|
||||
publish
|
||||
exit 0
|
||||
elif [ $# -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
|
||||
edit)
|
||||
open_file "$2"
|
||||
exit 0
|
||||
;;
|
||||
rm)
|
||||
remove_file "$2"
|
||||
exit 0
|
||||
|
39
home-manager/modules/scripts/note
Executable file
39
home-manager/modules/scripts/note
Executable 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
|
Loading…
Reference in New Issue
Block a user