feat: adding the main structure

This commit is contained in:
Carlos
2024-11-23 15:42:35 -05:00
parent 0a56ad814d
commit 579673056c
32 changed files with 26335 additions and 11 deletions

View File

@@ -0,0 +1,28 @@
const os = require('os');
const { spawn } = require('child_process');
const chalk = require('chalk');
function openInTerminal(directory) {
const platform = os.platform();
if (platform === 'darwin') {
// macOS
spawn('open', ['-a', 'Terminal', directory]);
} else if (platform === 'win32') {
// Windows
spawn('cmd.exe', ['/c', 'start', 'cmd.exe', '/K', `cd /d ${directory}`], {
shell: true,
});
} else if (platform === 'linux') {
// Linux
spawn('gnome-terminal', ['--working-directory=' + directory]);
} else {
console.log(
chalk.red(
'Unsupported platform. Please manually navigate to the directory.'
)
);
}
}
module.exports = { openInTerminal };