about summary refs log tree commit diff stats
path: root/073next-token.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-05-20 23:34:04 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-20 23:36:00 -0700
commitf707ed0bac2ea4c938e145bc33cec517e499db29 (patch)
tree573c346d8e4d273b4c5165867138455739778652 /073next-token.subx
parent5b840c7b2adecf49e9a5aacda0aa1f1fa4828fd4 (diff)
downloadmu-f707ed0bac2ea4c938e145bc33cec517e499db29.tar.gz
mu.subx: 15 failing tests remaining
The remaining tests are all for user-defined types and arrays.
Diffstat (limited to '073next-token.subx')
0 files changed, 0 insertions, 0 deletions
a.io> 2020-01-30 14:56:12 -0800 new scripts, switched to ksh, and a lot more' href='/ensa/cfg/commit/bin/opener?id=8fa69fc68072910f855958b3b79360ede1a32682'>8fa69fc ^
310c76b ^
8fa69fc ^

e1d03e2 ^
8fa69fc ^

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
         
                 












                                                                                
                                                                  

                
                                                            




                                                       
                                                    

               
                                                             

                 
                                                                                                                                                         

                           
#!/bin/sh
# op: file OPener
# takes one path as its argument, launches the appropriate program for it
if ! [ -f "$1" ]; then
	printf 'file %s does not exist!\n' "$1" >/dev/stderr
	return 1
fi
FILEPATH="$1"
FILEMIME="$(file -ib "$FILEPATH")"
echo() {
	printf '%s\n' "$*"
}
case "$FILEMIME" in
	#ebooks
	application/epub*|application/pdf|application/postscript|image/vnd.djvu)
		${READER:-zathura} "$FILEPATH">/dev/null 2>&1 & ;;
	#videos
	video/*)
		mpv --quiet "$FILEPATH" >/dev/null 2>&1 & ;;
	#images
	image/*)
		sxiv -a "$FILEPATH">/dev/null 2>&1 & ;;
	#audio
	audio/*)
		mpv "$FILEPATH" >/dev/null 2>&1 & ;;
	#text
	text/*)
		${EDITOR:-vi} "$FILEPATH">/dev/null 2>&1 & ;;
	#catchall
	*)
		echo "file $(basename "$FILEPATH") could not be opened. its type is $FILEMIME, go tell ensa that $(basename $0) didn't work" >/dev/stderr
		return 1 ;;
esac