<commit_before>/* global shellHelper, __prettyShell:true, sprintf */

__prettyShell = false

shellHelper.pretty = function() {
  __prettyShell = true
  print('pretty printing: enabled');
}

shellHelper.ugly = function() {
  __prettyShell = false
  print('pretty printing: disabled');
}

;(function() {

  shellHelper.d = function() {
    db.getMongo().getDBs().databases.forEach(function(d) {
      var numberOfCollections = db.getMongo().getDB(d.name).getCollectionNames().length
      print(
        sprintf('%-30s\t%s', d.name,
          ((d.sizeOnDisk > 1) ?
            numberOfCollections + '/' + bytesToSize(d.sizeOnDisk) :
            '(empty)'
          ))
      );
    })
  }

  shellHelper.c = function() {
    db.getCollections().forEach(function(c) {
      print(
        sprintf('%-30s\t%s', c.getName(),
          ((c.totalSize() > 0) ?
            c.count() + '/' + bytesToSize(c.totalSize()) :
            '(empty)'
          ))
      );<commit_msg>Add aliases for c and d commands<commit_after>/* global shellHelper, __prettyShell:true, sprintf */

__prettyShell = false

shellHelper.pretty = function() {
  __prettyShell = true
  print('pretty printing: enabled');
}

shellHelper.ugly = function() {
  __prettyShell = false
  print('pretty printing: disabled');
}

;(function() {

  shellHelper.databases = shellHelper.dbs = shellHelper.d = function() {
    db.getMongo().getDBs().databases.forEach(function(d) {
      var numberOfCollections = db.getMongo().getDB(d.name).getCollectionNames().length
      print(
        sprintf('%-30s\t%s', d.name,
          ((d.sizeOnDisk > 1) ?
            numberOfCollections + '/' + bytesToSize(d.sizeOnDisk) :
            '(empty)'
          ))
      );
    })
  }

  shellHelper.collections = shellHelper.colls = shellHelper.c = function() {
    db.getCollections().forEach(function(c) {
      print(
        sprintf('%-30s\t%s', c.getName(),
          ((c.totalSize() > 0) ?
            c.count() + '/' + bytesToSize(c.totalSize()) :
            '(empty)'
          ))
      );
{'fraction_non_alphanumeric': 0.16478666012751347, 'fraction_numerical': 0.005885237861696911, 'mean_word_length': 2.5478260869565217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6388169', 'n_tokens_mistral': 676, 'n_tokens_neox': 647, 'n_words': 104}