UNPKG

631 BPlain TextView Raw
1#!/usr/bin/env node
2
3/*
4 * osx "say"
5 *
6 */
7
8
9var exec = require("child_process").exec;
10var cui = require("../lib/cui");
11
12
13cui.push({
14 title: "Choose a voice:",
15 type: "buttons",
16 data: function (cb) {
17 var s = exec("say -v ?", function (err, voices) {
18 voices = voices.split("\n").slice(0, -1);
19 voices = voices.map(function (v) { return v.split(" ")[0] });
20 cb(null, voices);
21 });
22 }
23});
24
25cui.push({
26 type: "fields",
27 data: "Type a message: ",
28 action: function () {
29 var voice = cui.results[0];
30 var message = cui.results[1];
31 exec("say -v \"" + voice + "\" \"" + message + "\"");
32 }
33});