mirror of
https://github.com/He4eT/cheap-glkote.git
synced 2026-05-05 00:47:28 +00:00
Move player.stdio
This commit is contained in:
parent
1a9bf1ad0d
commit
b9e4269aa4
4 changed files with 6 additions and 5 deletions
|
|
@ -1,62 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* @see: https://github.com/curiousdannii/emglken/blob/master/bin/emglken.js
|
||||
*/
|
||||
|
||||
const fs = require('fs')
|
||||
const minimist = require('minimist')
|
||||
|
||||
const CheapGlkOte = require('../src/')
|
||||
const { handlers } = require('../src/stdio')
|
||||
|
||||
const formats = [
|
||||
{
|
||||
id: 'bocfel',
|
||||
extensions: /z([3458]|blorb)$/,
|
||||
engine: 'bocfel.js',
|
||||
},
|
||||
{
|
||||
id: 'glulxe',
|
||||
extensions: /(gblorb|ulx)$/,
|
||||
engine: 'glulxe.js',
|
||||
},
|
||||
{
|
||||
id: 'git',
|
||||
extensions: /(gblorb|ulx)$/,
|
||||
engine: 'git.js',
|
||||
},
|
||||
{
|
||||
id: 'hugo',
|
||||
extensions: /hex$/,
|
||||
engine: 'hugo.js',
|
||||
},
|
||||
{
|
||||
id: 'tads',
|
||||
extensions: /(gam|t3)$/,
|
||||
engine: 'tads.js',
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
const argv = minimist(process.argv.slice(2))
|
||||
const storyfile = argv._[0]
|
||||
|
||||
const format = formats.find(x =>
|
||||
x.extensions.test(storyfile))
|
||||
|
||||
if (!format) {
|
||||
console.error('Unknown storyfile format')
|
||||
return
|
||||
}
|
||||
|
||||
const { glkInterface, sendFn } = CheapGlkOte(handlers)
|
||||
handlers.setSend(sendFn)
|
||||
|
||||
const engine = require('emglken/src/' + format.engine)
|
||||
const vm = new engine()
|
||||
|
||||
vm.prepare(
|
||||
fs.readFileSync(storyfile),
|
||||
glkInterface)
|
||||
vm.start()
|
||||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
node player.stdio.js praxix.z5 < <(sleep 1 && echo 'all')
|
||||
node ../bin/player.stdio.js praxix.z5 < <(sleep 1 && echo 'all')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue