Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 2x 6x 4x 4x 2x 6x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x 6x 6x 6x 1x 1x 1x 5x 5x 5x 5x 6x 2x 2x 5x 5x 5x 6x 1x 1x 5x 5x 6x 2x 2x 2x 2x 2x 2x 2x 2x 6x 3x 3x 1x | const kanbn = require('../main');
const utility = require('../utility');
const inquirer = require('inquirer');
/**
* Start a new sprint interactively
* @param {?string} [name=null] The sprint name
* @param {?string} [description=null] The sprint description
* @return {Promise<any>}
*/
async function interactive(name = null, description = null) {
return await inquirer.prompt([
{
type: 'input',
name: 'name',
message: 'Sprint name:',
default: name || '',
validate: async value => {
if (!value) {
return 'Sprint name cannot be empty';
}
return true;
}
},
{
type: 'confirm',
name: 'setDescription',
message: 'Add a description?',
default: false
},
{
type: 'editor',
name: 'description',
message: 'Sprint description:',
default: description || '',
when: answers => answers.setDescription
}
]);
}
/**
* Start a new sprint
* @param {string} name
* @param {string} description
*/
function startSprint(name, description) {
kanbn
.sprint(name, description, new Date())
.then(sprint => {
console.log(`Started new sprint "${sprint.name}" at ${sprint.start.toISOString()}`);
})
.catch(error => {
utility.error(error);
});
}
module.exports = async args => {
// Make sure kanbn has been initialised
if (!await kanbn.initialised()) {
utility.error('Kanbn has not been initialised in this folder\nTry running: {b}kanbn init{b}');
return;
}
// Get sprint settings from arguments
// Name
let name = '';
if (args.name) {
name = utility.strArg(args.name);
}
// Description
let description = '';
if (args.description) {
description = utility.strArg(args.description);
}
// Start sprint interactively
if (args.interactive) {
interactive(name, description)
.then(answers => {
startSprint(answers.name, answers.description || '');
})
.catch(error => {
utility.error(error);
});
// Otherwise start sprint non-interactively
} else {
startSprint(name, description);
}
};
|