<commit_before>/*
 * app/lib/commands/group/listFeatures.js
 *
 *
 * Copyright (C) 2015  <NAME> <<EMAIL>>
 *
 * License in LICENSE file at the root of the repository.
 *
 */


var Promise = require("bluebird"),
    helpers = require('../../helpers');


function listFeatures () {
    var self = this,
        current = self.current(),
        userId = current[0],
        groupId = current[1],
        layerId = current[2],
        shell = self.shell,
        stdout = self.sys.stdout,
        binder = self.binder,
        terminal = shell.terminal;

    var res = function(resolve, reject){
        binder.getFeatures(userId, groupId, layerId)
            .then(function(features){
                for(var i = 0; i < features.length; i++){
                    var feature = features[i];
                    // var fidL = feature.id.length; 
                    // var fIdtrim = '•'+feature.id.substr(0, 2)+'\u2026'+feature.id.substr(fidL - 2, fidL);
                    var fName = feature.get('name');
                        if (Bind.get().db.has(id)) { 
                            var model = Bind.get().db.get(id);
                            fName = helpers.getModelName(model);
                        };
                    var cmd = terminal.makeCommand({
                        'args': [
                            'cc /'+userId+'/'+groupId+'/'+layerId+'/'+feature.id,
                            'gg | region set',
                            'get'
                            ],
                        'text': fName
                    });
                    stdout.write(cmd || '');
                }
                resolve();
            })
            .catch(reject);
    }
    return (new Promise(res));
};


module.exports = exports = {
    name: 'listFeatures',
    command: listFeatures
};
<commit_msg>oeps, broken lf<commit_after>/*
 * app/lib/commands/group/listFeatures.js
 *
 *
 * Copyright (C) 2015  <NAME> <<EMAIL>>
 *
 * License in LICENSE file at the root of the repository.
 *
 */


var Promise = require("bluebird");

function listFeatures () {
    var self = this,
        current = self.current(),
        userId = current[0],
        groupId = current[1],
        layerId = current[2],
        shell = self.shell,
        stdout = self.sys.stdout,
        binder = self.binder,
        terminal = shell.terminal;

    var res = function(resolve, reject){
        binder.getFeatures(userId, groupId, layerId)
            .then(function(features){
                for(var i = 0; i < features.length; i++){
                    var feature = features[i];
                    var fidL = feature.id.length; 
                    var fIdtrim = '•'+feature.id.substr(0, 2)+'\u2026'+feature.id.substr(fidL - 2, fidL);
                    var fName = feature.get('name');
                        if (fName === '' || fName == null) { 
                            fName = fIdtrim;
                        };
                    var cmd = terminal.makeCommand({
                        'args': [
                            'cc /'+userId+'/'+groupId+'/'+layerId+'/'+feature.id,
                            'gg | region set',
                            'get'
                            ],
                        'text': fName
                    });
                    stdout.write(cmd || '');
                }
                resolve();
            })
            .catch(reject);
    }
    return (new Promise(res));
};


module.exports = exports = {
    name: 'listFeatures',
    command: listFeatures
};

{'fraction_non_alphanumeric': 0.13602941176470587, 'fraction_numerical': 0.008484162895927601, 'mean_word_length': 1.25, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '5921603', 'n_tokens_mistral': 995, 'n_tokens_neox': 938, 'n_words': 205}