cz-customizable icon indicating copy to clipboard operation
cz-customizable copied to clipboard

Prefill ticket number answer automatically

Open alejandro-a opened this issue 4 years ago • 1 comments

Hi,

I created a script that adds ticketNumberPrefix and ticketNumber automatically but ticketNumber is required otherwise the final commit appears to be empty.

cz-customizable standalone version


Line 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.

? Select the type of change that you're committing: feat:     A new feature
? 
Choose the SCOPE of this change (optional): my-component
? Enter the ticket number:
 
? Write a SHORT, IMPERATIVE tense description of the change:
 
? List any BREAKING CHANGES (optional):
 
? List any ISSUES CLOSED by this change (optional). E.g.: #31, #34:
 

###--------------------------------------------------------###
feat(my-component): 
###--------------------------------------------------------###

? Are you sure you want to proceed with the commit above? (Yneh) 

In the buildCommit.js the if condition returns ''

const addTicketNumber = (ticketNumber, config) => {
  if (!ticketNumber) {
    return '';
  }
  ...
};

Is it possible to have some sort of 'ticketNumberValue' that doesn't ask anything but instantiate the variable ticketNumber?

alejandro-a avatar Oct 21 '19 00:10 alejandro-a

I am not sure if I understood your issue. You wrote your own script that has some ticket number and you would like to bring it to cz-customizable?

If so, look at the stand alone configuration: https://github.com/leonardoanalista/cz-customizable#option-2---cz-customizable-in-standalone-mode-new and https://github.com/leonardoanalista/cz-customizable/blob/master/standalone.js

We could extend this part app.prompter(inquirer, commit); to take a third param with prefilled options?

Hope I understood your problem otherwise write a draft PR to illustrate.

cheers Leonardo

leonardoanalista avatar Oct 21 '19 22:10 leonardoanalista