-
Notifications
You must be signed in to change notification settings - Fork 0
/
xz-java.in
47 lines (45 loc) · 1.17 KB
/
xz-java.in
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
#!/bin/bash
function help()
{
echo "XZ-Java Usage:"
echo
echo " -d, --decompress <file>:"
echo " Decompress <file>"
echo
echo " -c, --stdout <file>:"
echo " Decompress <file> to standard output"
echo
echo " -z, --compress <file>:"
echo " Compress <file>"
echo
echo " -h, --help:"
echo " Shows this help"
echo
}
case x"$1" in
x-d|x--d|x--de|x--dec|x--deco|x--decom|x--decomp|x--decompr|x--decompre|x--decompres|x--decompress)
shift
for file in `echo "$@" | sed 's,\.xz,,g'`; do
java -jar @PREFIX@/share/jdk8/lib/XZDecDemo.jar < ${file}.xz > ${file}
done
exit 0;;
x-z|x--c|x--co|x--com|x--comp|x--compr|x--compre|x--compres|x--compress)
shift
for file in "$@"; do
java -jar @PREFIX@/share/jdk8/lib/XZEncDemo.jar < ${file} > ${file}.xz
done
exit 0;;
x-c|x--s|x--st|x--std|x--stdo|x--stdou|x--stdout)
shift
java -jar @PREFIX@/share/jdk8/lib/XZDecDemo.jar "$@"
exit 0;;
x-h|x--he|x--hel|x--help)
help
exit 0;;
x)
help
exit 1;;
x*)
echo "Unknown option '$1'"
exit 1;;
esac