aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts/yazi-file-chooser/script.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules/scripts/yazi-file-chooser/script.sh')
-rw-r--r--modules/scripts/yazi-file-chooser/script.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/scripts/yazi-file-chooser/script.sh b/modules/scripts/yazi-file-chooser/script.sh
new file mode 100644
index 0000000..a2f9166
--- /dev/null
+++ b/modules/scripts/yazi-file-chooser/script.sh
@@ -0,0 +1,20 @@
+# $1 = multiple selection (1/0)
+# $2 = directory select mode (1/0)
+# $3 = save file mode (1/0)
+# $4 = initial directory path
+# $5 = output path file (where portal expects selected paths)
+
+multiple="$1"
+directory="$2"
+save="$3"
+path="$4"
+out="$5"
+
+# Pick directory vs single/multiple file
+if [ "$directory" = "1" ]; then
+ # --cwd-file outputs the final working directory path when exiting
+ exec yazi "$path" --cwd-file="$out"
+else
+ # --chooser-file writes all selected file path(s) to $out on exit
+ exec yazi "$path" --chooser-file="$out"
+fi