Skip to content

Commit

Permalink
added sub-categories list
Browse files Browse the repository at this point in the history
  • Loading branch information
stringbeans committed Apr 4, 2017
1 parent 66a044b commit 0c0a5d2
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,44 @@ module.exports = function (options) {
value: ''
}];

var subCategories = {
'pricing-engine': [{
name: 'Vocational & High-School',
value: 'vocational-high-school'
}, {
name: 'Expanding Pricing Engine',
value: 'engine-expansion'
}, {
name: 'Package Concept',
value: 'packages'
}, {
name: 'Uncategorized',
value: ''
}],

'api-v2': [{
name: 'Legacy Conversion v1 -> v2',
value: 'legacy-conversion'
}, {
name: 'Development of API',
value: 'v2-development'
}, {
name: 'Webhook Support',
value: 'webhook-support'
}, {
name: 'Uncategorized',
value: ''
}],

'data-warehousing-tracking': [{
name: 'Consolidating Dispersed Data',
value: 'data-collection'
}, {
name: 'Uncategorized',
value: ''
}]
};

return {
// When a user runs `git cz`, prompter will
// be executed. We pass you cz, which currently
Expand Down Expand Up @@ -79,6 +117,18 @@ module.exports = function (options) {
name: 'project',
message: 'Select the project this commit should fall into:',
choices: projects
}, {
when: function(response) {
return response.project === 'pricing-engine' ||
response.project === 'api-v2' ||
response.project === 'data-warehousing-tracking'
},
type: 'list',
name: 'problem',
message: 'Choose a sub-category of the project',
choices: function(response) {
return subCategories[response.project]
}
}, {
type: 'input',
name: 'footer',
Expand All @@ -104,19 +154,24 @@ module.exports = function (options) {
// Add SRED.io code
var hours = '';
var project = '';
var subProject = '';

if (answers.hours.trim()) {
hours = '-d ' + answers.hours.trim();
}

if (answers.project.trim()) {
project = '-p ' + answers.project;

if (answers.problem.trim()) {
subProject = '-c ' + answers.problem
}
}

var sred = ''

if (hours || project) {
sred = 'sred ' + [hours, project].join(' ')
sred = 'sred ' + [hours, project, subProject].join(' ')
}

var footer = wrap(answers.footer, wrapOptions);
Expand Down

0 comments on commit 0c0a5d2

Please sign in to comment.