My Little Automation Script

My Little Automation Script

It's a simple script that helps to launch VSCode and Terminal at the provided path.

I have to just type node project.js

const { exec } = require('child_process');
const fullpath = '/desire/path';

main();

function main() {
  launchVSCodeAt(fullpath);
  launchTerminalAt(fullpath);
}

function launchVSCodeAt(path) {
  exec(`cd ${path} && code .`, (err) => {
    if (err) console.log(`failed to launch VSCcode at ${path}`);
    console.log(`VSCode launched at ${path}`);
  });
}
function launchTerminalAt(path) {
  exec(`cd ${path} && gnome-terminal`, (error) => {
    if (error) console.log(`failed to launch Terminal at ${path}`);
    console.log(`Terminal launched at ${path}`);
  });
}

What you automate? Let me know in the comments.

BTW I am new to HashNode.