add enquire

main
Yanick Champoux 2020-12-30 18:50:42 -05:00
parent 2bf41f6d71
commit bf32c59770
3 changed files with 20 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules/
pnpm-debug.log
pnpm-lock.yaml
dist

View File

@ -10,6 +10,7 @@
"author": "Yanick Champoux <yanick@babyl.ca> (http://techblog.babyl.ca)",
"license": "ISC",
"dependencies": {
"@types/inquirer": "^7.3.1",
"@types/node": "^14.14.16",
"@types/yargs": "^15.0.12",
"inquirer": "^7.3.3",

View File

@ -1,13 +1,27 @@
import Git from 'simple-git';
import inquirer from 'inquirer';
async function check_workspace_clean() {
return Git().status().then( (result) => {
if(!result.isClean()) throw new Error('workspace not clean, aborting');
})
return Git().status().then((result) => {
if (!result.isClean()) throw new Error('workspace not clean, aborting');
})
}
export default async () => {
await check_workspace_clean();
console.log( 'yay');
const result = await Git().branch({'--merged': 'HEAD'});
const ancestors = result.all;
const resp = await inquirer.prompt([
{
name: 'parent',
message: 'grand-parent branch: ',
type: 'list',
choices: ancestors,
}
])
console.log(resp);
}