MCPcopy Index your code
hub / github.com/ampproject/amphtml / getFilesFromArgv

Function getFilesFromArgv

build-system/common/utils.js:78–94  ·  view source on GitHub ↗

* Extracts the list of files from argv.files. Throws an error if no matching * files were found. * * @return {Array }

()

Source from the content-addressed store, hash-verified

76 * @return {Array<string>}
77 */
78function getFilesFromArgv() {
79 if (!argv.files) {
80 return [];
81 }
82 const toPosix = (str) => str.replace(/\\\\?/g, '/');
83 const globs = Array.isArray(argv.files) ? argv.files : argv.files.split(',');
84 const allFiles = [];
85 for (const glob of globs) {
86 const files = fastGlob.sync(toPosix(glob.trim()));
87 if (files.length == 0) {
88 log(red('ERROR:'), 'Argument', cyan(glob), 'matched zero files.');
89 throw new Error('Argument matched zero files.');
90 }
91 allFiles.push(...files);
92 }
93 return allFiles;
94}
95
96/**
97 * Returns list of files in the comma-separated file named at --filelist.

Callers 4

runTests_Function · 0.85
runWatch_Function · 0.85
updateFilesMethod · 0.85
getFilesToCheckFunction · 0.85

Calls 6

redFunction · 0.85
cyanFunction · 0.85
syncMethod · 0.80
toPosixFunction · 0.70
logFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected