const ssbClient = require('ssb-client') const ref = require('ssb-ref') const argv = require('minimist')(process.argv) const createServer = require('./server') const SSBNews = require('.') ssbClient((err, sbot) => { if (err) { throw err } const news = new SSBNews(sbot) if (argv._[2] === 'server') { createServer(sbot) } else if (argv._[2] === 'story') { if (ref.isMsg(argv._[3])) { news.story(argv._[3], (err, story) => { if (err) throw err console.log(story) sbot.close() }) } else { throw new Error('story [id]') } } else { throw new Error('unknown command') } })