@@ -19,6 +19,10 @@ class Input {
19
19
}
20
20
}
21
21
22
+ function commaSeparatedPathsList ( value ) {
23
+ return value . split ( ',' ) ;
24
+ }
25
+
22
26
function commaSeparatedCodesList ( value , dummyPrevious ) {
23
27
return value . split ( ',' ) . map ( function ( item ) {
24
28
return parseInt ( item , 10 ) ;
@@ -34,6 +38,7 @@ function getInputs() {
34
38
. option ( '-c, --config [config]' , 'apply a config file (JSON), holding e.g. url specific header configuration' )
35
39
. option ( '-q, --quiet' , 'displays errors only' )
36
40
. option ( '-v, --verbose' , 'displays detailed error information' )
41
+ . option ( '-i --ignore <paths>' , 'ignore input paths including an ignore path' , commaSeparatedPathsList )
37
42
. option ( '-a, --alive <code>' , 'comma separated list of HTTP codes to be considered as alive' , commaSeparatedCodesList )
38
43
. option ( '-r, --retry' , 'retry after the duration indicated in \'retry-after\' header when HTTP code is 429' )
39
44
. option ( '--projectBaseUrl <url>' , 'the URL to use for {{BASEURL}} replacement' )
@@ -81,7 +86,16 @@ function getInputs() {
81
86
console . error ( chalk . red ( '\nERROR: ' + filenameOrUrl + ' is a directory! Please provide a valid filename as an argument.' ) ) ;
82
87
process . exit ( 1 ) ;
83
88
}
84
- baseUrl = 'file://' + path . dirname ( path . resolve ( filenameOrUrl ) ) ;
89
+
90
+ const resolved = path . resolve ( filenameOrUrl ) ;
91
+
92
+ // skip paths given if it includes a path to ignore.
93
+ // todo: allow ignore paths to be glob or regex instead of just includes?
94
+ if ( program . opts ( ) . ignore . some ( ( ignorePath ) => resolved . includes ( ignorePath ) ) ) {
95
+ continue ;
96
+ }
97
+
98
+ baseUrl = 'file://' + path . dirname ( resolved ) ;
85
99
stream = fs . createReadStream ( filenameOrUrl ) ;
86
100
}
87
101
@@ -100,7 +114,7 @@ function getInputs() {
100
114
if ( config ) {
101
115
input . opts . config = config . trim ( ) ;
102
116
}
103
-
117
+
104
118
if ( program . projectBaseUrl ) {
105
119
input . opts . projectBaseUrl = `file://${ program . projectBaseUrl } ` ;
106
120
} else {
0 commit comments