/
helpDocs.js
78 lines (64 loc) · 2.9 KB
/
helpDocs.js
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
'use strict';
/**
* Running:
* $ bz --help
*
* Output:
* ┌──────────────────────────────────────────────────────────────────────────────┐
* │ Help Docs │
* └──────────────────────────────────────────────────────────────────────────────┘
* ┌──────────────────────────────────────────────────────────┐
* │ MyTasks │
* └──────────────────────────────────────────────────────────┘
* task1
* ES7 Decorator Example MyTasks - Task 1
* task2
* ES7 Decorator Example MyTasks - Task 2
* ┌──────────────────────────────────────────────────────────┐
* │ MyTasks2 │
* └──────────────────────────────────────────────────────────┘
* task1
* ES7 Decorator Example MyTasks2 - Task 1
* task2
* ES7 Decorator Example MyTasks2 - Task 2
*
*/
/**
* -- Note --
* Node does not support decorators so you will need to run this with bable-cli
* $ ../../node_modules/.bin/babel-node decorator.js
*
* To use in your own projects you will need to add babel with the
* 'babel-plugin-transform-decorators-legacy' plugin
*/
// simulate loading from a different BZ (for Global vs Local), but still functioanlly the same
const Beelzebub = require('../../');
class MyTasks extends Beelzebub.Tasks {
constructor (config) {
super(config);
this.$setDefault('task1');
this.$setTaskHelpDocs('task1', 'ES7 Decorator Example MyTasks - Task 1');
this.$setTaskHelpDocs('task2', 'ES7 Decorator Example MyTasks - Task 2');
}
task1 () {
this.logger.log('MyTasks task1');
}
task2 () {
this.logger.log('MyTasks task2');
}
}
class MyTasks2 extends Beelzebub.Tasks {
constructor (config) {
super(config);
this.$setDefault('task1');
this.$setTaskHelpDocs('task1', 'ES7 Decorator Example MyTasks2 - Task 1');
this.$setTaskHelpDocs('task2', 'ES7 Decorator Example MyTasks2 - Task 2');
}
task1 () {
this.logger.log('MyTasks2 task1');
}
task2 () {
this.logger.log('MyTasks2 task2');
}
}
module.exports = [MyTasks, MyTasks2];