MCPcopy
hub / github.com/wdjungst/react-project / promptApproval

Function promptApproval

modules/LogUtils.js:26–49  ·  view source on GitHub ↗
(msg, cb)

Source from the content-addressed store, hash-verified

24
25
26export function promptApproval(msg, cb) {
27 if (process.env.NODE_ENV === 'test' || process.env.NODE_ENV === 'production') {
28 logError('Wanted to prompt approval but skipping because we are in production or test')
29 log('Prompt message was: ', msg)
30 cb()
31 } else {
32 prompt.start()
33 const property = {
34 name: 'yesno',
35 message: msg + ' (y|n)',
36 validator: /y|n/,
37 warning: 'Must respond "y" for yes or "n" for no',
38 default: 'n'
39 }
40 prompt.get(property, (err, result) => {
41 if (result.yesno === 'y') {
42 cb && cb()
43 } else {
44 logError('FINE!')
45 process.exit()
46 }
47 })
48 }
49}
50

Callers

nothing calls this directly

Calls 2

logErrorFunction · 0.85
logFunction · 0.85

Tested by

no test coverage detected