configuration.nix/bin/ks
2023-12-16 16:04:06 +02:00

23 lines
443 B
Bash
Executable File

#!/usr/bin/env bash
doc_dir=$(xdg-user-dir DOCUMENTS)
ks_dir="$doc_dir/ks"
name="$1"
full_path="$ks_dir/$name.md.gpg"
tmpfile="/tmp/$name.md"
mkdir -p "$ks_dir"
cd "$ks_dir"
if [ -f "$full_path" ]; then
gpg --decrypt -o "$tmpfile" "$full_path"
else
touch "$tmpfile"
fi
$EDITOR "$tmpfile"
gpg --encrypt -r ivan@idimitrov.dev -o "$full_path" "$tmpfile"
git add . && git commit -m "editing $name" && git push --set-upstream origin HEAD