1 module gherkin.util; 2 3 import std.algorithm : filter; 4 import std.file : isDir, dirEntries, isFile, SpanMode; 5 import std.path : extension; 6 7 /// 8 string[] getFeatureFiles(string[] args) 9 { 10 string[] featureFilesAndDirs = args.length > 1 ? args[1 .. $] : ["features"]; 11 string[] featureFiles; 12 13 foreach (fileOrDir; featureFilesAndDirs) 14 { 15 if (fileOrDir.isFile) 16 { 17 featureFiles ~= fileOrDir; 18 } 19 else if (fileOrDir.isDir) 20 { 21 foreach (file; dirEntries(fileOrDir, SpanMode.breadth).filter!(a => a.isFile 22 && extension(a) == ".feature")) 23 { 24 featureFiles ~= file; 25 } 26 } 27 } 28 29 return featureFiles; 30 }