"format cjs";

var wrap = require('word-wrap');

// This can be any kind of SystemJS compatible module.
// We use Commonjs here, but ES6 or AMD would do just
// fine.
module.exports = {

  // When a user runs `git cz`, prompter will
  // be executed. We pass you cz, which currently
  // is just an instance of inquirer.js. Using
  // this you can ask questions and get answers.
  //
  // The commit callback should be executed when
  // you're ready to send back a commit template
  // to git.
  //
  // By default, we'll de-indent your commit
  // template and will keep empty lines.
  prompter: function(cz, commit) {
    console.log('\nLine 1 will be cropped at 100 characters. All other lines will be wrapped after 100 characters.\n');

    // Let's ask some questions of the user
    // so that we can populate our commit
    // template.
    //
    // See inquirer.js docs for specifics.
    // You can also opt to use another input
    // collection library if you prefer.
    cz.prompt([
      {
        type: 'list',
        name: 'type',
        message: 'Select the type of change that you\'re committing:',
        choices: [
        {
          name: 'story:      故事卡',
          value: 'STORY'
        }, {
          name: 'bug:      bug fix',
          value: 'BUG'
        }, {
          name: 'commit:      普通提交',
          value: 'COMMIT'
          }]
      }, {
        type: 'input',
        name: 'scope',
        message: 'Jira Issue ID(s) 或者 输入一个普通提交信息 (必填):\n',
        validate: function(input) {
          if (!input) {
            return '必须输入一个Jira Issue ID(s) 或者 输入一个普通提交信息';
          } else {
            return true;
          }
        }
      }, {
        type: 'input',
        name: 'subject',
        message: '对Jira Issue ID(s)的一个简单描述(小于100字):\n'
      }, {
        type: 'input',
        name: 'body',
        message: '详细描述(可选):\n'
      }
    ]).then(function(answers) {

      var maxLineWidth = 100;

      var wrapOptions = {
        trim: true,
        newline: '\n',
        indent:'',
        width: maxLineWidth
      };

      // parentheses are only needed when a scope is present
      var scope = answers.scope.trim();
      scope = scope ? '[' + answers.scope.trim() + ']' : '';

      // Hard limit this line
      var head = (answers.type + scope + ': ' + answers.subject.trim()).slice(0, maxLineWidth);
      if(answers.type === 'COMMIT') {
          var subject = answers.subject.trim();
          subject = subject ? ' - ' + answers.subject.trim() : '';
          head = (answers.type + ': ' + answers.scope.trim() + ' - ' + subject).slice(0, maxLineWidth);
      }

      // Wrap these lines at 100 characters
      var body = answers.body.trim();
      body = body ? '\n详细描述: ' + answers.body.trim() : ''
      var body = wrap(body, wrapOptions);

      commit(head + '\n' + body);
    });
  }
}

@@ -1136,26 +1136,30 @@
 : %5B%0A        
-%7B%0A
+  %7B%0A  
           na
@@ -1183,32 +1183,34 @@
 %E6%95%85%E4%BA%8B%E5%8D%A1',%0A          
+  
 value: 'STORY'%0A 
@@ -1208,32 +1208,34 @@
 'STORY'%0A        
+  
 %7D, %7B%0A          n
@@ -1225,32 +1225,34 @@
  %7D, %7B%0A          
+ 
+ 
 name: 'bug:     
@@ -1264,32 +1264,34 @@
 fix',%0A          
+  
 value: 'BUG'%0A   
@@ -1287,16 +1287,18 @@
 : 'BUG'%0A
+  
         
@@ -1308,24 +1308,26 @@
 %7B%0A          
+  
 name: 'commi
@@ -1341,16 +1341,18 @@
  %E6%99%AE%E9%80%9A%E6%8F%90%E4%BA%A4',%0A
+  
         
@@ -1602,26 +1602,24 @@
  ID(s) %E6%88%96%E8%80%85 %E8%BE%93%E5%85%A5
-%E4%B8%80%E4%B8%AA
 %E6%99%AE%E9%80%9A%E6%8F%90%E4%BA%A4%E4%BF%A1%E6%81%AF';%0A   
@@ -1787,15 +1787,23 @@
 %E5%8D%95%E6%8F%8F%E8%BF%B0(
-%E5%B0%8F%E4%BA%8E100%E5%AD%97)
+%E5%BF%85%E5%A1%AB) %E6%99%AE%E9%80%9A%E6%8F%90%E4%BA%A4%E5%8F%AF%E7%9B%B4%E6%8E%A5%E5%9B%9E%E8%BD%A6%E8%B7%B3%E8%BF%87
 :%5Cn'
@@ -2419,26 +2419,24 @@
 ) %7B%0A        
-  
 var subject 
@@ -2457,26 +2457,24 @@
 ect.trim();%0A
-  
         subj
@@ -2534,18 +2534,16 @@
         
-  
 head = (
@@ -2586,24 +2586,16 @@
 trim() +
- ' - ' +
  subject

update index.js