git ssb

1+

bencevans / ssb-news



Tree: 42db44acea925a145748bffb1196e0ec554485c2

Files: 42db44acea925a145748bffb1196e0ec554485c2 / src / cli.js

648 bytesRaw
1const ssbClient = require('ssb-client')
2const ref = require('ssb-ref')
3const argv = require('minimist')(process.argv)
4const createServer = require('./server')
5const SSBNews = require('.')
6
7ssbClient((err, sbot) => {
8 if (err) {
9 throw err
10 }
11 const news = new SSBNews(sbot)
12
13 if (argv._[2] === 'server') {
14 createServer(sbot)
15 } else if (argv._[2] === 'story') {
16 if (ref.isMsg(argv._[3])) {
17 news.story(argv._[3], (err, story) => {
18 if (err) throw err
19 console.log(story)
20 sbot.close()
21 })
22 } else {
23 throw new Error('story [id]')
24 }
25 } else {
26 throw new Error('unknown command')
27 }
28})
29

Built with git-ssb-web