aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts/yazi-file-chooser/script.sh
blob: a2f9166cd312565f29525b17394cab8ec4d7580b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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