1 const child = require("child_process")
3 module.exports.fzf = (options, binary = "fzf") => {
5 const prom = new Promise((rs, rj) => [res, rej] = [rs, rj])
7 const proc = child.spawn(binary)
8 options.forEach(opt => proc.stdin.write(opt + "\n"))
11 proc.stdout.on("data", chunk => {
14 proc.stderr.pipe(process.stderr)
16 proc.on("close", code => {
26 module.exports.doujin = doujins => module.exports.fzf(doujins.sort(), __dirname + "/fzf-previews")
27 .then(doujin => child.spawn("firefox", [`file://${process.cwd()}/${doujin}/index.html`]))