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