Skip to content

Instantly share code, notes, and snippets.

@farmanp
Last active December 20, 2019 07:55
Show Gist options
  • Save farmanp/90d6c96d00ddd1913db8752e5f37d8e5 to your computer and use it in GitHub Desktop.
Save farmanp/90d6c96d00ddd1913db8752e5f37d8e5 to your computer and use it in GitHub Desktop.
// var branch = process.argv.slice(2).join('_');
// console.log(`Branch name: ${branch}`);
// console.log(`Copy and paste below`);
// console.log(`git checkout -b ${branch}`);
function execute(command) {
const exec = require('child_process').exec
exec(command, (err, stdout, stderr) => {
process.stdout.write(stdout)
})
}
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("Ticket number: ", function(tNumber) {
rl.question("Ticket name: ", function(tName) {
var branch = tName.replace(/ /g, "_").toLowerCase();
console.log(`Branch name: ${branch}`);
console.log(`Running the following command: git checkout -b story/${tNumber}/${branch}`);
execute(`git checkout -b story/${tNumber}/${branch}`)
rl.close();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment