about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xranger/data/scope.sh35
1 files changed, 14 insertions, 21 deletions
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index b516904f..626d2395 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -127,9 +127,8 @@ handle_image() {
         # Archive
         # application/zip|application/x-rar|application/x-7z-compressed|\
         #     application/x-xz|application/x-bzip2|application/x-gzip|application/x-tar)
-        #     local fn=""
-        #     local bsd=""
-        #     local zip=""; local rar=""; local tar=""
+        #     local fn=""; local fe=""
+        #     local zip=""; local rar=""; local tar=""; local bsd=""
         #     case "${mimetype}" in
         #         application/zip) zip=1 ;;
         #         application/x-rar) rar=1 ;;
@@ -137,8 +136,8 @@ handle_image() {
         #         *) tar=1 ;;
         #     esac
         #     { [ "$tar" ] && fn=$(tar --list --file "${FILE_PATH}"); } || \
-        #     { bsd=1 && fn=$(bsdtar --list --file "${FILE_PATH}"); } || \
-        #     { bsd="" && [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
+        #     { fn=$(bsdtar --list --file "${FILE_PATH}") && bsd=1 && tar=""; } || \
+        #     { [ "$rar" ] && fn=$(unrar lb -p- -- "${FILE_PATH}"); } || \
         #     { [ "$zip" ] && fn=$(zipinfo -1 -- "${FILE_PATH}"); } || return
         #
         #     fn=$(echo "$fn" | python -c "import sys; import mimetypes as m; \
@@ -148,23 +147,17 @@ handle_image() {
         #     [ "$fn" = "" ] && return
         #     [ "$bsd" ] && fn=$(printf '%b' "$fn")
         #
-        #     if [ "$tar" ] && [ -z "$bsd" ]; then
-        #         tar --extract --to-stdout --file "${FILE_PATH}" -- "$fn" > \
-        #             "${IMAGE_CACHE_PATH}" && exit 6
-        #         rm -- "${IMAGE_CACHE_PATH}"
-        #         return
-        #     fi
-        #     # bsdtar and unzip need escaping.
-        #     fne=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
-        #     bsdtar --extract --to-stdout --file "${FILE_PATH}" -- "$fne" > \
+        #     [ "$tar" ] && tar --extract --to-stdout \
+        #         --file "${FILE_PATH}" -- "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
+        #     fe=$(echo -n "$fn" | sed 's/[][*?\]/\\\0/g')
+        #     [ "$bsd" ] && bsdtar --extract --to-stdout \
+        #         --file "${FILE_PATH}" -- "$fe" > "${IMAGE_CACHE_PATH}" && exit 6
+        #     [ "$bsd" ] || [ "$tar" ] && rm -- "${IMAGE_CACHE_PATH}"
+        #     [ "$rar" ] && unrar p -p- -inul -- "${FILE_PATH}" "$fn" > \
         #         "${IMAGE_CACHE_PATH}" && exit 6
-        #     rm -- "${IMAGE_CACHE_PATH}"
-        #     if [ "$rar" ]; then
-        #         unrar p -p- -inul -- "${FILE_PATH}" "$fn" > "${IMAGE_CACHE_PATH}" && exit 6
-        #     elif [ "$zip" ]; then
-        #         unzip -pP "" -- "${FILE_PATH}" "$fne" > "${IMAGE_CACHE_PATH}" && exit 6
-        #     else return; fi
-        #     rm -- "${IMAGE_CACHE_PATH}"
+        #     [ "$zip" ] && unzip -pP "" -- "${FILE_PATH}" "$fe" > \
+        #         "${IMAGE_CACHE_PATH}" && exit 6
+        #     [ "$rar" ] || [ "$zip" ] && rm -- "${IMAGE_CACHE_PATH}"
         #     ;;
     esac
 }
a> ^
84ca523f ^
248e789e ^
52ea3102 ^
248e789e ^




224474d7 ^

248e789e ^
aee46a25 ^








bcafd01f ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153