This commit is contained in:
commit
95a533c876
451 changed files with 18255 additions and 0 deletions
16
pkgs/quicknote/default.nix
Normal file
16
pkgs/quicknote/default.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
writeShellApplication,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
name = "quicknote";
|
||||
text = builtins.readFile ./${name}.sh;
|
||||
in
|
||||
writeShellApplication {
|
||||
inherit name text;
|
||||
meta.mainProgram = name;
|
||||
|
||||
runtimeInputs = [
|
||||
];
|
||||
}
|
||||
30
pkgs/quicknote/quicknote.sh
Normal file
30
pkgs/quicknote/quicknote.sh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ -n "$XDG_DOCUMENTS_DIR" ]; then
|
||||
NOTES_DIR="$XDG_DOCUMENTS_DIR/notes"
|
||||
else
|
||||
NOTES_DIR="/tmp/notes"
|
||||
fi
|
||||
|
||||
mkdir -p "$NOTES_DIR"
|
||||
|
||||
TIMESTAMP=$(date +"%Y-%m-%d_%H-%M-%S")
|
||||
NOTE_FILE="$NOTES_DIR/note_$TIMESTAMP.md"
|
||||
touch "$NOTE_FILE"
|
||||
|
||||
if [ -z "$EDITOR" ]; then
|
||||
# Try common editors
|
||||
for editor in vim vi nano; do
|
||||
if command -v "$editor" &> /dev/null; then
|
||||
EDITOR="$editor"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$EDITOR" ]; then
|
||||
echo "Error: No editor found. Please set the EDITOR environment variable."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
"$EDITOR" "$NOTE_FILE"
|
||||
Loading…
Add table
Add a link
Reference in a new issue