41 lines
1012 B
JavaScript
41 lines
1012 B
JavaScript
const OS = require('../../server/models/tablas/OS');
|
|
const colors = require('colors');
|
|
const progress = require('cli-progress');
|
|
|
|
async function fillOS() {
|
|
let limit = 7;
|
|
const bar = new progress.SingleBar({
|
|
format: 'OS |' + colors.cyan('{bar}') + '| {percentage}%' + ' || {value}/{total} records created.',
|
|
barCompleteChar: '\u2588',
|
|
barIncompleteChar: '\u2591',
|
|
hideCursor: true,
|
|
stopOnComplete: true,
|
|
barsize: 30,
|
|
align: 'right'
|
|
});
|
|
let sistemas = [
|
|
"Windows 7",
|
|
"Windows 10",
|
|
"Debian",
|
|
"Fedora",
|
|
"CentOS",
|
|
"Ubuntu",
|
|
"MacOS"
|
|
];
|
|
|
|
console.log('\n\tFilling out «OS».'.cyan.italic.bold);
|
|
|
|
bar.start(limit, 0);
|
|
for (osname of sistemas) {
|
|
await OS.create({
|
|
osname
|
|
})
|
|
.catch(() => {
|
|
bar.stop();
|
|
throw new Error();
|
|
});
|
|
bar.increment();
|
|
};
|
|
};
|
|
|
|
module.exports = fillOS; |