mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
b5fe3f3b0c
Added basic modules for the trascription tool Assembly and the Documentation tool ChatGPT
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
module.exports = {
|
|
name:"cliCommands",
|
|
async function(command, args){
|
|
switch(command){
|
|
case "exit":
|
|
process.exit(1);
|
|
break;
|
|
case "reload":
|
|
mapFunctions.clear()
|
|
// Reloading the Function Map
|
|
var path = `${mainDir}/services/modules`
|
|
var folders = fs.readdirSync(path).filter(function (file) {
|
|
return fs.statSync(path+'/'+file).isDirectory();
|
|
});
|
|
folders.forEach(element => {
|
|
var commandFiles = fs.readdirSync(`${path}/${element}`).filter(file => file.endsWith('.js') && !file.startsWith("index"));
|
|
for (const file of commandFiles) {
|
|
delete require.cache[require.resolve(`${path}/${element}/${file}`)];
|
|
const command = require(`${path}/${element}/${file}`);
|
|
mapFunctions.set(command.name, command);
|
|
}
|
|
});
|
|
console.log(`Reloaded ${mapFunctions.size} modules`)
|
|
break;
|
|
default:
|
|
console.log("This is not a recognised command");
|
|
break;
|
|
};
|
|
}
|
|
}
|