export default rm

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

let db = new PouchDB(conf.db)

function rm (yargs) {
  let argv = yargs
    .usage('tick rm entryid')
    .argv

  db.get(argv._[1])
  .then(removeEntry)
}

function removeEntry (doc) {
  const e = Entry.fromJSON(doc)
  write(e)
  return db.remove(doc).then(result => { console.log(chalk.bgRed('removed')) })
}

@@ -230,18 +230,16 @@
 = yargs%0A
-  
   .usage
@@ -244,16 +244,23 @@
 ge('
+Usage: 
 tick rm 
 entr
@@ -259,20 +259,69 @@
  rm 
-entryid')%0A  
+%5Boptions%5D %3Centryid ...%3E')%0A  .help('h')%0A  .alias('h', 'help')%0A
   .a

Clean up tick rm usage and add help