1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT License. See License.txt in the project root for license information.
3
3
4
- ' use strict' ;
5
- const log = require ( ' ../util/logging' ) ,
6
- validate = require ( ' ../validate' ) ;
4
+ " use strict" ;
5
+ const log = require ( " ../util/logging" ) ,
6
+ validate = require ( " ../validate" ) ;
7
7
8
- exports . command = ' compare <old-spec> <new-spec>' ;
8
+ exports . command = " compare <old-spec> <new-spec>" ;
9
9
10
- exports . describe = 'Compares old and new open api specification for breaking changes.' ;
10
+ exports . describe =
11
+ "Compares old and new open api specification for breaking changes." ;
11
12
12
13
exports . builder = {
13
14
j : {
14
- alias : 'inJson' ,
15
- describe : 'A boolean flag indicating whether output format of the messages is json.' ,
15
+ alias : "inJson" ,
16
+ describe :
17
+ "A boolean flag indicating whether output format of the messages is json." ,
16
18
boolean : true ,
17
19
default : true
18
20
} ,
19
21
o : {
20
- alias : 'oldTagName' ,
21
- describe : 'The tag name for the old specification file. If included it indicates that the old spec file is a readme file' ,
22
+ alias : "oldTagName" ,
23
+ describe :
24
+ "The tag name for the old specification file. If included it indicates that the old spec file is a readme file"
22
25
} ,
23
26
n : {
24
- alias : 'newTagName' ,
25
- describe : 'The tag name for the new specification file. If included it indicates that the new spec file is a readme file' ,
27
+ alias : "newTagName" ,
28
+ describe :
29
+ "The tag name for the new specification file. If included it indicates that the new spec file is a readme file"
26
30
}
27
31
} ;
28
32
29
- exports . handler = function ( argv ) {
33
+ exports . handler = function ( argv ) {
30
34
log . debug ( argv ) ;
31
35
let oldSpec = argv . oldSpec ;
32
36
let oldTag = argv . o ;
@@ -36,20 +40,28 @@ exports.handler = function (argv) {
36
40
vOptions . consoleLogLevel = argv . logLevel ;
37
41
vOptions . logFilepath = argv . f ;
38
42
vOptions . json = argv . j ;
39
-
43
+
40
44
let compareFunc ;
41
- if ( oldTag && newTag ) {
42
- compareFunc = validate . compareTags ( oldSpec , oldTag , oldSpec , newTag , vOptions ) ;
43
- } else {
45
+ if ( oldTag && newTag ) {
46
+ compareFunc = validate . compareTags (
47
+ oldSpec ,
48
+ oldTag ,
49
+ newSpec ,
50
+ newTag ,
51
+ vOptions
52
+ ) ;
53
+ } else {
44
54
compareFunc = validate . compare ( oldSpec , newSpec , vOptions ) ;
45
55
}
46
-
47
- return compareFunc . then ( ( result ) => {
48
- console . log ( result ) ;
49
- } ) . catch ( err => {
50
- console . log ( err ) ;
51
- process . exitCode = 1 ;
52
- } ) ;
53
- }
56
+
57
+ return compareFunc
58
+ . then ( result => {
59
+ console . log ( result ) ;
60
+ } )
61
+ . catch ( err => {
62
+ console . log ( err ) ;
63
+ process . exitCode = 1 ;
64
+ } ) ;
65
+ } ;
54
66
55
67
exports = module . exports ;
0 commit comments