diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-20 18:13:32 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-12-20 18:25:57 +0100 |
commit | 796449ef00d90970c7c2e2cab6bbfb3de16abf3d (patch) | |
tree | 68e3f55da3e806cc3b14bdedeee8a82a5b206bf9 /pkgs/by-name/ne/neorg/functions | |
parent | fix(modules/lf/ctpv/prev/any): Fix typo in `preview_xxd` function call (diff) | |
download | nixos-config-796449ef00d90970c7c2e2cab6bbfb3de16abf3d.tar.gz nixos-config-796449ef00d90970c7c2e2cab6bbfb3de16abf3d.zip |
feat(pkgs/neorg): Init `inputs` subcommand
Diffstat (limited to '')
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/add.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/context.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/dmenu.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/f_start.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/f_stop.sh | 0 | ||||
-rw-r--r-- | pkgs/by-name/ne/neorg/functions/inputs.sh | 38 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/list.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/project.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/review.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/utils.sh | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | pkgs/by-name/ne/neorg/functions/workspace.sh | 0 |
11 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/by-name/ne/neorg/functions/add.sh b/pkgs/by-name/ne/neorg/functions/add.sh index 5a830a10..5a830a10 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/add.sh +++ b/pkgs/by-name/ne/neorg/functions/add.sh diff --git a/pkgs/by-name/ne/neorg/functions/context.sh b/pkgs/by-name/ne/neorg/functions/context.sh index 7095847d..7095847d 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/context.sh +++ b/pkgs/by-name/ne/neorg/functions/context.sh diff --git a/pkgs/by-name/ne/neorg/functions/dmenu.sh b/pkgs/by-name/ne/neorg/functions/dmenu.sh index 5a138982..5a138982 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/dmenu.sh +++ b/pkgs/by-name/ne/neorg/functions/dmenu.sh diff --git a/pkgs/by-name/ne/neorg/functions/f_start.sh b/pkgs/by-name/ne/neorg/functions/f_start.sh index 2423dd44..2423dd44 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/f_start.sh +++ b/pkgs/by-name/ne/neorg/functions/f_start.sh diff --git a/pkgs/by-name/ne/neorg/functions/f_stop.sh b/pkgs/by-name/ne/neorg/functions/f_stop.sh index e4ff0b94..e4ff0b94 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/f_stop.sh +++ b/pkgs/by-name/ne/neorg/functions/f_stop.sh 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 index 10659457..10659457 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/list.sh +++ b/pkgs/by-name/ne/neorg/functions/list.sh diff --git a/pkgs/by-name/ne/neorg/functions/project.sh b/pkgs/by-name/ne/neorg/functions/project.sh index 64591850..64591850 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/project.sh +++ b/pkgs/by-name/ne/neorg/functions/project.sh diff --git a/pkgs/by-name/ne/neorg/functions/review.sh b/pkgs/by-name/ne/neorg/functions/review.sh index a0a9ab8d..a0a9ab8d 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/review.sh +++ b/pkgs/by-name/ne/neorg/functions/review.sh diff --git a/pkgs/by-name/ne/neorg/functions/utils.sh b/pkgs/by-name/ne/neorg/functions/utils.sh index c3843e8e..c3843e8e 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/utils.sh +++ b/pkgs/by-name/ne/neorg/functions/utils.sh diff --git a/pkgs/by-name/ne/neorg/functions/workspace.sh b/pkgs/by-name/ne/neorg/functions/workspace.sh index d5eb2fca..d5eb2fca 100755..100644 --- a/pkgs/by-name/ne/neorg/functions/workspace.sh +++ b/pkgs/by-name/ne/neorg/functions/workspace.sh |