git ssb

39+

cel / git-ssb



Tree: 873ff04e1eef1fb6e86d5e48cbaf0da8e8ac7dfe

Files: 873ff04e1eef1fb6e86d5e48cbaf0da8e8ac7dfe / lib / issues.js

1363 bytesRaw
1var pull = require('pull-stream')
2var paramap = require('pull-paramap')
3var u = require('./util')
4var getAbout = require('ssb-avatar')
5var Issues = require('ssb-issues')
6
7module.exports = function (argv) {
8 if (argv._.length > 1) return require('./help')(argv)
9
10 process.stderr.write('Loading issues...\r')
11 var id = u.getRemote(argv._[0])
12 if (!id) throw 'unable to find git-ssb repo'
13
14 var open = u.issueStateBool(argv)
15
16 u.getSbot(argv, function (err, sbot) {
17 if (err) throw err
18 sbot.whoami(function (err, feed) {
19 if (err) throw err
20 var issues = Issues.init(sbot)
21 pull(
22 issues.list({
23 project: id,
24 open: open
25 }),
26 paramap(function (issue, cb) {
27 getAbout(sbot, feed.id, issue.author, function (err, authorAbout) {
28 issue.authorName = authorAbout.name
29 cb(err, issue)
30 })
31 // TODO: show issue petnames?
32 }, 8),
33 pull.map(function (issue) {
34 return issue.id + ' ' +
35 '@' + issue.authorName + ' ' +
36 (open == null ? issue.open ? 'open: ' : 'closed: ' : '') +
37 u.formatTitle(issue.text, 60)
38 }),
39 pull.drain(function (line) {
40 console.log(line)
41 }, function (err) {
42 if (err) throw err
43 process.exit(0)
44 })
45 )
46 })
47 })
48}
49
50

Built with git-ssb-web