diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-20 19:55:00 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-20 19:55:00 +0100 |
commit | 8adecc39fe33cb1ea9e73aa74d1254f680474ef2 (patch) | |
tree | 78ae86f1df4087251a26f729e19085a48ff80e84 /pkgs/by-name/ne/neorg/functions/inputs.sh | |
parent | feat(pkgs/neorg): Init `inputs` subcommand (diff) | |
download | nixos-config-8adecc39fe33cb1ea9e73aa74d1254f680474ef2.tar.gz nixos-config-8adecc39fe33cb1ea9e73aa74d1254f680474ef2.zip |
fix(pkgs/neorg/inputs): Add git support and fix further bugs
Diffstat (limited to 'pkgs/by-name/ne/neorg/functions/inputs.sh')
-rw-r--r-- | pkgs/by-name/ne/neorg/functions/inputs.sh | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/by-name/ne/neorg/functions/inputs.sh b/pkgs/by-name/ne/neorg/functions/inputs.sh index 613d7574..52efcc47 100644 --- a/pkgs/by-name/ne/neorg/functions/inputs.sh +++ b/pkgs/by-name/ne/neorg/functions/inputs.sh @@ -5,8 +5,20 @@ inputs0add() { mkdir --parents "$(dirname "%NEORG_INPUTS_STORAGE_FILE")" - clean "$url_file" >>"%NEORG_INPUTS_STORAGE_FILE" && - msg2 "Successfully added file '$url_file' with $(wc -l <"$url_file") entries to the url list" + { + # Add another newline + echo "" + # echo "# $url_file " + + clean "$url_file" + } >>"%NEORG_INPUTS_STORAGE_FILE" && + msg2 "Successfully added file '$url_file' with $(clean "$url_file" | wc -l) entries to the url list" + + cd "$(dirname "%NEORG_INPUTS_STORAGE_FILE")" || die "BUG. This should exist." + + [ -d .git ] || git init + git add . + git commit --message "Add entries from '$url_file' ($(clean "$url_file" | wc -l))" --no-gpg-sign } inputs0review() { @@ -18,10 +30,11 @@ inputs0review() { # We assume that the project is not yet open. firefox -P "$base_profile" & + # Give it some time to start up. + sleep 2 while read -r url; do msg "Adding url '$url'" - notify-send "Neorg" "Reviewing '$url'" firefox -P "$base_profile" "$url" echo "$url" >>"$done_urls" @@ -35,4 +48,6 @@ inputs0review() { awk 'NR==FNR {a[$0]=1; next} !a[$0]' "$done_urls" "%NEORG_INPUTS_STORAGE_FILE" >"$tmp" mv "$tmp" "%NEORG_INPUTS_STORAGE_FILE" + git add . + git commit --message "Dump entries into firefox profile '$base_profile'" --no-gpg-sign } |