<commit_before>/*
 * Copyright 2013 <NAME>, All Rights Reserved.
 *
 * Code licensed under the BSD License:
 * https://github.com/eduardolundgren/blob/master/LICENSE.md
 *
 * @author <NAME> <<EMAIL>>
 */

// -- Requires -----------------------------------------------------------------
var async = require('async'),
    base = require('../base'),
    clc = require('cli-color'),
    logger = require('../logger'),
    open = require('open');

// -- Constructor --------------------------------------------------------------
function Issue(options) {
    this.options = options;

    if (!options.repo && !options.all) {
        logger.error('You must specify a Git repository to run this command');
    }
}

// -- Constants ----------------------------------------------------------------
Issue.DETAILS = {
    description: 'Provides a set of util commands to work with Issues.',
    options: {
        'all'     : Boolean,
        'close'   : Boolean,
        'comment' : String,
        'detailed': Boolean,
        'label'   : String,
        'list'    : Boolean,
        'message' : String,
        'new'     : Boolean,
        'number'  : Number,
        'open'    : Boolean,
        'repo'    : String,
        'state'   : [ 'open', 'closed' ],
        'title'   : String,
        'user'    : String
    },
    shorthands: {
        'a': [ '--all' ],
        'C': [ '--close' ],
        'c': [ '--comment' ],
        'd': [ '--detailed' ],
        'L': [ '--label' ],
        'l': [ '--list' ],
        'm': [ '--message' ],
        'N': [ '--new' ],
        'n': [ '--number' ],
        'o': [ '--open' ],
        'r': [ '--repo' ],
        'S': [ '--state' ],
        't': [ '--title' ],
        'u': [ '--user' ]
    },
};

Issue.STATE_CLOSED = 'closed';
Issue.STATE_OPEN = 'open';

// -- Commands -----------------------------------------------------------------
Issue.prototype.run = function() {
    var instance = this,
        options = instance.options,
        config = base.getGlobalConfig();

    options.state = options.state || Issue.STATE_OPEN;

    if (options.close) {
        options.state = Issue.STATE_CLOSED;

        logger.logTemplate('{{prefix}} [info] Closing issue {{greenBright "#" options.number}} on {{greenBright options.user "/" options.repo}}', {
            options: options
        });
<commit_msg>#36 Add custom payload for issues<commit_after>/*
 * Copyright 2013 <NAME>, All Rights Reserved.
 *
 * Code licensed under the BSD License:
 * https://github.com/eduardolundgren/blob/master/LICENSE.md
 *
 * @author <NAME> <<EMAIL>>
 */

// -- Requires -----------------------------------------------------------------
var async = require('async'),
    base = require('../base'),
    clc = require('cli-color'),
    logger = require('../logger'),
    open = require('open');

// -- Constructor --------------------------------------------------------------
function Issue(options) {
    this.options = options;

    if (!options.repo && !options.all) {
        logger.error('You must specify a Git repository to run this command');
    }
}

// -- Constants ----------------------------------------------------------------
Issue.DETAILS = {
    description: 'Provides a set of util commands to work with Issues.',
    options: {
        'all'     : Boolean,
        'close'   : Boolean,
        'comment' : String,
        'detailed': Boolean,
        'label'   : String,
        'list'    : Boolean,
        'message' : String,
        'new'     : Boolean,
        'number'  : Number,
        'open'    : Boolean,
        'repo'    : String,
        'state'   : [ 'open', 'closed' ],
        'title'   : String,
        'user'    : String
    },
    shorthands: {
        'a': [ '--all' ],
        'C': [ '--close' ],
        'c': [ '--comment' ],
        'd': [ '--detailed' ],
        'L': [ '--label' ],
        'l': [ '--list' ],
        'm': [ '--message' ],
        'N': [ '--new' ],
        'n': [ '--number' ],
        'o': [ '--open' ],
        'r': [ '--repo' ],
        'S': [ '--state' ],
        't': [ '--title' ],
        'u': [ '--user' ]
    },
    payload: function(payload, options) {
        if (payload[0]) {
            options.new = true;
            options.title = options.title || payload[0];
            options.message = options.message || payload[1];
        }
        else {
            options.list = true;
        }
    }
};

Issue.STATE_CLOSED = 'closed';
Issue.STATE_OPEN = 'open';

// -- Commands -----------------------------------------------------------------
Issue.prototype.run = function() {
    var instance = this,
        options = instance.options,
        config = base.getGlobalConfig();

    options.state = options.state || Issue.STATE_OPEN;

    if (options.close) {
        options.state = Issue.STATE_CLOSED;

        logger.logTemplate('{{prefix}} [info] Closing issue {{greenBright "#" options.number}} on {{greenBright options.user "/" options.repo}}', {
            options: options
        });

{'fraction_non_alphanumeric': 0.2716519647153168, 'fraction_numerical': 0.0026062550120288693, 'mean_word_length': 1.3962536023054755, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7007284', 'n_tokens_mistral': 1443, 'n_tokens_neox': 1413, 'n_words': 325}