forked from moinejf/abc2svg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
abcnode
executable file
·53 lines (45 loc) · 893 Bytes
/
abcnode
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
#!/bin/sh
# abc2svg with raw nodeJS
progdir=`dirname $0`
cat abc2svg-1.js cmdline.js > /tmp/toto.js
case $1 in
*.js)
cat $1 >> /tmp/toto.js
shift
;;
*)
cat toxhtml.js >> /tmp/toto.js
;;
esac
cat <<EOF >> /tmp/toto.js
var fs = require("fs"),
progdir='${progdir}/'
function print(str) {
process.stdout.write(str + '\n')
}
function printErr(str) {
process.stderr.write(str + '\n')
}
function readFile(fname) {
return fs.readFileSync(fname).toString()
}
function loadRelativeToScript(script) {
var geval = eval;
geval(readFile(progdir + script))
}
function quit() {
process.exit(1)
}
// main
var args = process.argv
if (!args[2]) {
print("abcnode-" + abc2svg.version + " " + abc2svg.vdate + "\n" +
" ABC to SVG translator\n" +
" Usage: abcnode [options] ABC_file");
exit(1)
}
args.shift()
args.shift()
abc_cmd("abcnode", args)
EOF
node /tmp/toto.js "$@"