<commit_before>export default list

import Entry from '../entry'
import PouchDB from 'pouchdb'
import {write} from './output'

let db = new PouchDB('tickbin')

function list (yargs) {
  let argv = yargs
  .usage('tick list')
  .help('h')
  .alias('h', 'help')
  .argv

  db.query(mapDate, {
    include_docs: true,
    descending: true
  }).then(writeEntries)

}

function mapDate (doc) {
  emit(doc._id)
}

function writeEntries (results) {
  results.rows.forEach(function(row) {
    // this is likely slow as it requires creating a new entry
    // but write requires an instatiated Entry at the moment
    write(new Entry(row.doc.message))     
  })

}<commit_msg>listing entries with fromJSON so we can show the actual _id<commit_after>export default list

import Entry from '../entry'
import PouchDB from 'pouchdb'
import {write} from './output'

let db = new PouchDB('tickbin')

function list (yargs) {
  let argv = yargs
  .usage('tick list')
  .help('h')
  .alias('h', 'help')
  .argv

  db.query(mapDate, {
    include_docs: true,
    descending: true
  }).then(writeEntries)

}

function mapDate (doc) {
  emit(doc._id)
}

function writeEntries (results) {
  results.rows.forEach(function(row) {
    // this is likely slow as it requires creating a new entry
    // but write requires an instatiated Entry at the moment
    write(Entry.fromJSON(row.doc))     
  })

}
{'fraction_non_alphanumeric': 0.12490922294843863, 'fraction_numerical': 0.0, 'mean_word_length': 3.388535031847134, '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': '196075', 'n_tokens_mistral': 458, 'n_tokens_neox': 453, 'n_words': 143}