add enquire

This commit is contained in:
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/ node_modules/
pnpm-debug.log pnpm-debug.log
pnpm-lock.yaml pnpm-lock.yaml
dist

View File

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

View File

@ -1,13 +1,27 @@
import Git from 'simple-git'; import Git from 'simple-git';
import inquirer from 'inquirer';
async function check_workspace_clean() { async function check_workspace_clean() {
return Git().status().then( (result) => { return Git().status().then((result) => {
if(!result.isClean()) throw new Error('workspace not clean, aborting'); if (!result.isClean()) throw new Error('workspace not clean, aborting');
}) })
} }
export default async () => { export default async () => {
await check_workspace_clean(); 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);
} }