@jdeighan/coffee-utils 4.1.20 → 4.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/external.coffee +24 -0
- package/src/external.js +26 -0
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jdeighan/coffee-utils",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.21",
|
|
5
5
|
"description": "A set of utility functions for CoffeeScript",
|
|
6
6
|
"main": "coffee_utils.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": "./src/coffee_utils.js",
|
|
9
|
+
"./external": "./src/external.js",
|
|
9
10
|
"./fs": "./src/fs_utils.js",
|
|
10
11
|
"./log": "./src/log_utils.js",
|
|
11
12
|
"./block": "./src/block_utils.js",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# external.coffee
|
|
2
|
+
|
|
3
|
+
import getline from 'readline-sync'
|
|
4
|
+
import {execSync} from 'child_process'
|
|
5
|
+
|
|
6
|
+
# ---------------------------------------------------------------------------
|
|
7
|
+
# exec - run external commands
|
|
8
|
+
|
|
9
|
+
export exec = (cmd) ->
|
|
10
|
+
|
|
11
|
+
buffer = execSync cmd, {
|
|
12
|
+
windowsHide: true
|
|
13
|
+
}
|
|
14
|
+
return buffer.toString()
|
|
15
|
+
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
17
|
+
# ask - ask a question
|
|
18
|
+
# later, on a web page, prompt the user for answer to question
|
|
19
|
+
|
|
20
|
+
export ask = (prompt) ->
|
|
21
|
+
|
|
22
|
+
answer = getline.question("{prompt}? ")
|
|
23
|
+
return answer
|
|
24
|
+
|
package/src/external.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Generated by CoffeeScript 2.6.1
|
|
2
|
+
// external.coffee
|
|
3
|
+
import getline from 'readline-sync';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
execSync
|
|
7
|
+
} from 'child_process';
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// exec - run external commands
|
|
11
|
+
export var exec = function(cmd) {
|
|
12
|
+
var buffer;
|
|
13
|
+
buffer = execSync(cmd, {
|
|
14
|
+
windowsHide: true
|
|
15
|
+
});
|
|
16
|
+
return buffer.toString();
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// ask - ask a question
|
|
21
|
+
// later, on a web page, prompt the user for answer to question
|
|
22
|
+
export var ask = function(prompt) {
|
|
23
|
+
var answer;
|
|
24
|
+
answer = getline.question("{prompt}? ");
|
|
25
|
+
return answer;
|
|
26
|
+
};
|