From 796449ef00d90970c7c2e2cab6bbfb3de16abf3d Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 20 Dec 2024 18:13:32 +0100 Subject: feat(pkgs/neorg): Init `inputs` subcommand --- pkgs/by-name/ne/neorg/functions/add.sh | 0 pkgs/by-name/ne/neorg/functions/context.sh | 0 pkgs/by-name/ne/neorg/functions/dmenu.sh | 0 pkgs/by-name/ne/neorg/functions/f_start.sh | 0 pkgs/by-name/ne/neorg/functions/f_stop.sh | 0 pkgs/by-name/ne/neorg/functions/inputs.sh | 38 ++++++++++++++++++++++++++++ pkgs/by-name/ne/neorg/functions/list.sh | 0 pkgs/by-name/ne/neorg/functions/project.sh | 0 pkgs/by-name/ne/neorg/functions/review.sh | 0 pkgs/by-name/ne/neorg/functions/utils.sh | 0 pkgs/by-name/ne/neorg/functions/workspace.sh | 0 11 files changed, 38 insertions(+) mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/add.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/context.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/dmenu.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/f_start.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/f_stop.sh create mode 100644 pkgs/by-name/ne/neorg/functions/inputs.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/list.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/project.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/review.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/utils.sh mode change 100755 => 100644 pkgs/by-name/ne/neorg/functions/workspace.sh (limited to 'pkgs/by-name/ne/neorg/functions') diff --git a/pkgs/by-name/ne/neorg/functions/add.sh b/pkgs/by-name/ne/neorg/functions/add.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/context.sh b/pkgs/by-name/ne/neorg/functions/context.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/dmenu.sh b/pkgs/by-name/ne/neorg/functions/dmenu.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/f_start.sh b/pkgs/by-name/ne/neorg/functions/f_start.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/f_stop.sh b/pkgs/by-name/ne/neorg/functions/f_stop.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/inputs.sh b/pkgs/by-name/ne/neorg/functions/inputs.sh new file mode 100644 index 00000000..613d7574 --- /dev/null +++ b/pkgs/by-name/ne/neorg/functions/inputs.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env dash + +inputs0add() { + url_file="$1" + + 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" +} + +inputs0review() { + base_profile="$1" + + [ -f "%NEORG_INPUTS_STORAGE_FILE" ] || die "'%NEORG_INPUTS_STORAGE_FILE' is not a file. Have you added something with 'inputs_add' yet?" + + done_urls="$(mktmp)" + + # We assume that the project is not yet open. + firefox -P "$base_profile" & + + while read -r url; do + msg "Adding url '$url'" + notify-send "Neorg" "Reviewing '$url'" + firefox -P "$base_profile" "$url" + + echo "$url" >>"$done_urls" + done <"%NEORG_INPUTS_STORAGE_FILE" + + # Wait for the Firefox process from above to finish. + wait + + tmp="$(mktmp)" + # source: https://stackoverflow.com/a/24324455 + awk 'NR==FNR {a[$0]=1; next} !a[$0]' "$done_urls" "%NEORG_INPUTS_STORAGE_FILE" >"$tmp" + + mv "$tmp" "%NEORG_INPUTS_STORAGE_FILE" +} diff --git a/pkgs/by-name/ne/neorg/functions/list.sh b/pkgs/by-name/ne/neorg/functions/list.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/project.sh b/pkgs/by-name/ne/neorg/functions/project.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/review.sh b/pkgs/by-name/ne/neorg/functions/review.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/utils.sh b/pkgs/by-name/ne/neorg/functions/utils.sh old mode 100755 new mode 100644 diff --git a/pkgs/by-name/ne/neorg/functions/workspace.sh b/pkgs/by-name/ne/neorg/functions/workspace.sh old mode 100755 new mode 100644 -- cgit 1.4.1