<commit_before>var storage = require('../storage'),
    app     = require('../app'),
    util    = require('utile'),
    _       = require('lodash');



/**
 * Displays the currently active group if no group is passed.
 * Sets the passed group as the newly 'current' one.
 */
var group = module.exports = function(group, callback) {
  "use strict";
  
  // The currently active group should be printed
  if (!_.isString(group)) {
    return app.log.info(util.format('The %s is %s', 'active group'.yellow.bold, app.config.get('currentGroup').yellow.bold));
  }


  // A new group is being made active

  // Validate
  storage.get(['groups'], function(data) {
    if (_.isUndefined(data[group])) {
      return callback(new Error(util.format('%s is not a valid %s', group.yellow.bold, 'group name'.yellow.bold)));
    }
  });



  // Save the newly active gropu
  app.config.set('currentGroup', group);

  app.config.save(function(){
    app.log.info(util.format('The %s is now %s', 'active group'.yellow.bold, app.config.get('currentGroup').yellow.bold));
  });
};<commit_msg>Fixes inconsistent 'success' msg when group cmd is provided bad value<commit_after>var storage = require('../storage'),
    app     = require('../app'),
    util    = require('utile'),
    _       = require('lodash');



/**
 * Displays the currently active group if no group is passed.
 * Sets the passed group as the newly 'current' one.
 */
var group = module.exports = function(group, callback) {
  "use strict";

  // The currently active group should be printed
  if (!_.isString(group)) {
    return app.log.info(util.format('The %s is %s', 'active group'.yellow.bold, app.config.get('currentGroup').yellow.bold));
  }


  // A new group is being made active

  // Validate
  storage.get(['groups'], function(data) {
    if (_.isUndefined(data[group])) {
      return callback(new Error(util.format('%s is not a valid %s', group.yellow.bold, 'group name'.yellow.bold)));
    }

    // Save the newly active gropu
    app.config.set('currentGroup', group);

    app.config.save(function(){
      app.log.info(util.format('The %s is now %s', 'active group'.yellow.bold, app.config.get('currentGroup').yellow.bold));
    });
  });
};
{'fraction_non_alphanumeric': 0.16636528028933092, 'fraction_numerical': 0.0, 'mean_word_length': 3.297087378640777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6097254', 'n_tokens_mistral': 702, 'n_tokens_neox': 669, 'n_words': 190}