about summary refs log tree commit diff stats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/add.sh0
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/context.sh0
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/dmenu.sh0
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/f_start.sh0
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/f_stop.sh0
-rw-r--r--pkgs/by-name/ne/neorg/functions/inputs.sh38
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/list.sh0
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/project.sh0
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/review.sh0
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/utils.sh0
-rw-r--r--[-rwxr-xr-x]pkgs/by-name/ne/neorg/functions/workspace.sh0
-rwxr-xr-xpkgs/by-name/ne/neorg/main.sh31
-rw-r--r--pkgs/by-name/ne/neorg/package.nix3
13 files changed, 69 insertions, 3 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
diff --git a/pkgs/by-name/ne/neorg/main.sh b/pkgs/by-name/ne/neorg/main.sh
index 559351b9..b4f0f0e6 100755
--- a/pkgs/by-name/ne/neorg/main.sh
+++ b/pkgs/by-name/ne/neorg/main.sh
@@ -9,11 +9,12 @@ SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH
 . ./functions/dmenu.sh
 . ./functions/f_start.sh
 . ./functions/f_stop.sh
+. ./functions/inputs.sh
 . ./functions/list.sh
 . ./functions/project.sh
+. ./functions/review.sh
 . ./functions/utils.sh
 . ./functions/workspace.sh
-. ./functions/review.sh
 
 # these are used in version()
 # shellcheck disable=2034
@@ -70,15 +71,25 @@ COMMANDS:
 
     review
                             Review all firefox tabs
+
+    inputs_add F
+                            Add all urls from the file F as inputs to be catogorized
+
+    inputs_review P
+                            Like 'review', but for the inputs that have previously been added.
+                            It takes a project in which to open the urls.
 ARGUMENTS:
     ID | *([0-9]) := [[%ID_GENERATION_FUNCTION]]
                             The function displays all possible IDs of the eligable tasks.
 
     WS := %ALL_WORKSPACES
-                            All possible workspaces
+                            All possible workspaces.
 
     P := %ALL_PROJECTS_PIPE
-                            The possible project
+                            The possible project.
+
+    F := [[fd . --max-depth 3]]
+                            A URL-Input file to use as source.
 
 EOF
 }
@@ -153,6 +164,20 @@ while [ "$#" -ne 0 ]; do
         review0start
         exit 0
         ;;
+    "inputs_a"*) # inputs_add
+        shift 1
+        url_file="$1"
+        [ -f "$url_file" ] || die "Url file ('$url_file') is not a valid file."
+        inputs0add "$url_file"
+        exit 0
+        ;;
+    "inputs_r"*) # inputs_review
+        shift 1
+        base_project="$1"
+        [ -z "$base_project" ] && die "'inputs_review' requires a project."
+        inputs0review "$base_project"
+        exit 0
+        ;;
     *)
         die "Command '$1' does not exist! Please look at:\n $NAME --help"
         exit 0
diff --git a/pkgs/by-name/ne/neorg/package.nix b/pkgs/by-name/ne/neorg/package.nix
index a9ab1ca8..3d26d1fb 100644
--- a/pkgs/by-name/ne/neorg/package.nix
+++ b/pkgs/by-name/ne/neorg/package.nix
@@ -31,6 +31,7 @@ sysLib.writeShellScriptMultiPart {
     "dmenu.sh"
     "f_start.sh"
     "f_stop.sh"
+    "inputs.sh"
     "list.sh"
     "project.sh"
     "review.sh"
@@ -48,6 +49,8 @@ sysLib.writeShellScriptMultiPart {
     HOME_TASKRC = "${xdgConfigHome}/task/home-manager-taskrc";
     NEORG_REVIEW_PATH = "${xdgDataHome}/neorg/review";
 
+    NEORG_INPUTS_STORAGE_FILE = "${xdgDataHome}/neorg/inputs/url_list.txt";
+
     ALL_PROJECTS_NEWLINE = allProjectsNewline;
     ALL_PROJECTS_COMMA = allProjectsComma;
     ALL_PROJECTS_PIPE = allProjectsPipe;