-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
91 lines (71 loc) · 1.56 KB
/
index.js
File metadata and controls
91 lines (71 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
var vorpal = require('vorpal')();
vorpal.delimiter('ncli$').show();
vorpal
.command('duck', 'Outputs "rabbit"')
.action(function(args, callback) {
this.log('Wabbit');
callback();
});
vorpal
.command('now', "Now in unixtime")
.action(function(args, cb){
const self = this;
now();
cb();
});
vorpal
.command('hacker', "post to the #hacker")
.action(function(args, cb){
const self = this;
hacker();
cb();
});
vorpal
.command('promptstext', 'Asks questions')
.action(function(args, cb){
const self = this;
promptstext();
cb();
});
vorpal
.command('promptsselect', 'Asks questions')
.action(function(args, cb){
const self = this;
promptsselect();
cb();
});
function now(){
var Datetime = require('machinepack-datetime');
// Construct a new JS timestamp from the current time.
console.log(Datetime.now({}).execSync());
// console.log(Datetime.now);
}
function promptsselect(){
var prompts = require('machinepack-prompts');
var rxtext = '';
prompts.text({
message: 'Where do you want to post?',
paginated: false,
choices: [{name: 'hacker', value: 'some-unique-identifier'}]
}).exec({
error: function(err){},
success: function(result){
console.log('Result: ' + result);
}
});
}
function promptstext(){
var prompts = require('machinepack-prompts');
var rxtext = '';
prompts.text({
message: 'What do you want to post?',
protect: true,
expectJson: false,
exampleValue: 'why does it always rain?'
}).exec({
error: function(err){},
success: function(result){
console.log('Result: ' + result);
}
});
}