forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove.js
31 lines (26 loc) · 741 Bytes
/
remove.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
/* eslint no-restricted-syntax: 0 */
const del = require('del');
const path = require('path');
if (!process.argv.includes(__filename)) {
console.error('Usage: node scripts/remove.js <target ...>');
process.exit(1);
}
const toDeletes = process.argv
.slice(process.argv.indexOf(__filename + 1))
.map((item) => path.resolve(item));
if (toDeletes.length === 0) {
console.warn('Nothing to delete');
process.exit(0);
}
(async () => {
const deletedPaths = await del(toDeletes);
if (deletedPaths === 0) {
console.warn('Nothing deleted');
} else {
console.log('Deleted files and directories:\n\t', deletedPaths.join('\n\t'));
}
})();