-
Notifications
You must be signed in to change notification settings - Fork 0
/
m.ts
36 lines (34 loc) · 894 Bytes
/
m.ts
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
import Archive from './lib/archive.ts'
import Mg from './lib/mg.ts'
import Mf from './lib/mf.ts'
import Mo from './lib/mo.ts'
const [head, ...tail] = Deno.args
let output = '', archive = []
switch (head) {
case 'm':
await Archive.write('mr', tail)
console.log(tail.join(' '))
break
case 'mg':
[output, archive] = await Mg.run(tail)
await Archive.write('mo', archive)
console.log(output.join('\n'))
break
case 'mf':
[output, archive] = await Mf.run(tail)
await Archive.write('mo', archive)
console.log(output.join('\n'))
break
case 'mo':
archive = await Archive.read('mo');
[output, archive] = await Mo.run(tail, archive)
await Archive.write('mr', archive)
console.log(output)
break
case 'mr':
archive = await Archive.read('mr')
console.log(archive.join(' '))
break
default:
console.log('unknown!')
}