File tree Expand file tree Collapse file tree 3 files changed +29
-7
lines changed
tools/office-cmdlet-updater Expand file tree Collapse file tree 3 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -23,13 +23,23 @@ class CliController {
23
23
24
24
this . cliServoce . addOption ( {
25
25
option : '-c --cmdlet <cmdet>' ,
26
- description : 'update documentation for cmdlet in module'
26
+ description : 'update documentation for cmdlet in module' ,
27
+ action : ( cli ) => {
28
+ const { module, cmdlet } = cli ;
29
+
30
+ if ( module === 'all' && cmdlet ) {
31
+ throw new Error ( 'You must specify a module for cmdet.' ) ;
32
+ }
33
+ }
27
34
} ) ;
28
35
29
36
this . cliServoce . start ( argv , async ( cli ) => {
30
37
const { module, cmdlet } = cli ;
31
38
32
- this . markdownController . updateMarkdown ( { moduleName : module } ) ;
39
+ this . markdownController . updateMarkdown ( {
40
+ moduleName : module ,
41
+ cmdlet
42
+ } ) ;
33
43
console . log ( module ) ;
34
44
console . log ( cmdlet ) ;
35
45
} ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class MarkdownController {
19
19
throw new Error ( powerShellErrors . DOC_PATH_DOESNT_EXIST ) ;
20
20
}
21
21
22
- [ , err ] = await of ( this . markdownService . updateMd ( doc ) ) ;
22
+ [ , err ] = await of ( this . markdownService . updateMd ( doc , cmdlet ) ) ;
23
23
24
24
if ( err ) {
25
25
this . powerShellService . dispose ( ) ;
Original file line number Diff line number Diff line change @@ -31,12 +31,14 @@ class MarkdownService {
31
31
this . installedDependencies = [ ] ;
32
32
}
33
33
34
- async updateMd ( doc ) {
35
- return this . addMdFilesInQueue ( doc ) ;
34
+ async updateMd ( doc , cmdlet ) {
35
+ return this . addMdFilesInQueue ( doc , cmdlet ) ;
36
36
}
37
37
38
- async addMdFilesInQueue ( doc ) {
39
- const mdFiles = await this . fsService . getModuleFiles ( doc ) ;
38
+ async addMdFilesInQueue ( doc , cmdlet ) {
39
+ const mdFiles = ( await this . fsService . getModuleFiles ( doc ) ) . filter (
40
+ ( file ) => this . _filterCmdlets ( file , cmdlet )
41
+ ) ;
40
42
41
43
mdFiles . forEach ( ( file ) => {
42
44
this . queue
@@ -46,6 +48,16 @@ class MarkdownService {
46
48
} ) ;
47
49
}
48
50
51
+ _filterCmdlets ( mdPath , cmdletName ) {
52
+ if ( ! cmdletName ) {
53
+ return true ;
54
+ }
55
+
56
+ const mdExt = '.md' ;
57
+
58
+ return mdPath . endsWith ( `${ cmdletName } ${ mdExt } ` ) ;
59
+ }
60
+
49
61
async processQueue ( { file, doc } , cb ) {
50
62
let result , err ;
51
63
You can’t perform that action at this time.
0 commit comments