File tree 3 files changed +22
-0
lines changed 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,22 @@ const formatTap = require('../lib/format-tap')
14
14
const Validator = require ( '../lib' )
15
15
const Tap = require ( '../lib/tap' )
16
16
const utils = require ( '../lib/utils' )
17
+ const subsystem = require ( '../lib/rules/subsystem' )
17
18
const knownOpts = { help : Boolean
18
19
, version : Boolean
19
20
, 'validate-metadata' : Boolean
20
21
, tap : Boolean
21
22
, out : path
22
23
, list : Boolean
24
+ , 'list-subsystems' : Boolean
23
25
}
24
26
const shortHand = { h : [ '--help' ]
25
27
, v : [ '--version' ]
26
28
, V : [ '--validate-metadata' ]
27
29
, t : [ '--tap' ]
28
30
, o : [ '--out' ]
29
31
, l : [ '--list' ]
32
+ , ls : [ '--list-subsystems' ]
30
33
}
31
34
32
35
const parsed = nopt ( knownOpts , shortHand )
@@ -84,6 +87,11 @@ function loadPatch(uri, cb) {
84
87
85
88
const v = new Validator ( parsed )
86
89
90
+ if ( parsed [ 'list-subsystems' ] ) {
91
+ utils . describeSubsystem ( subsystem . defaults . subsystems )
92
+ return
93
+ }
94
+
87
95
if ( parsed . list ) {
88
96
const ruleNames = Array . from ( v . rules . keys ( ) )
89
97
const max = ruleNames . reduce ( ( m , item ) => {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ core-validate-commit - Validate the commit message for a particular commit in no
8
8
-V, --validate-metadata validate PR-URL and reviewers (on by default)
9
9
-t, --tap output in tap format
10
10
-l, --list list rules and their descriptions
11
+ -ls --list-subsystems list the available subsystems
11
12
12
13
examples:
13
14
Validate a single sha:
Original file line number Diff line number Diff line change @@ -45,3 +45,16 @@ exports.describeRule = function describeRule(rule, max = 20) {
45
45
console . log ( ' %s %s' , chalk . red ( title ) , chalk . dim ( desc ) )
46
46
}
47
47
}
48
+
49
+ exports . describeSubsystem = function describeSubsystem ( subsystems , max = 20 ) {
50
+ if ( subsystems ) {
51
+ for ( let sub = 0 ; sub < subsystems . length ; sub ++ ) {
52
+ console . log ( '%s %s %s' ,
53
+ chalk . green ( exports . leftPad ( subsystems [ sub ] || '' , max ) ) ,
54
+ chalk . green ( exports . leftPad ( subsystems [ sub + 1 ] || '' , max ) ) ,
55
+ chalk . green ( exports . leftPad ( subsystems [ sub + 2 ] || '' , max ) )
56
+ )
57
+ sub += 2
58
+ }
59
+ }
60
+ }
You can’t perform that action at this time.
0 commit comments