18 lines
551 B
JavaScript
18 lines
551 B
JavaScript
#!/usr/bin/env node
|
|
// Backup script for config-audit plugin
|
|
// Creates timestamped backups of config files before modification
|
|
// Usage: node backup-before-change.mjs <file1> [file2] ...
|
|
|
|
import { createBackup } from '../../scanners/lib/backup.mjs';
|
|
|
|
const files = process.argv.slice(2);
|
|
|
|
if (files.length === 0) {
|
|
process.stderr.write('Usage: node backup-before-change.mjs <file1> [file2] ...\n');
|
|
process.exit(1);
|
|
}
|
|
|
|
const { backupId, backupPath } = createBackup(files);
|
|
|
|
console.log(`Backup complete: ${backupPath}`);
|
|
console.log(backupPath);
|