Files: a09b2ebd1be805f4383f7b7b114a14678b39d5bb / lib / issues.js
1380 bytesRaw
1 | var pull = require('pull-stream') |
2 | var paramap = require('pull-paramap') |
3 | var u = require('./util') |
4 | var getAbout = require('ssb-avatar') |
5 | var Issues = require('ssb-issues') |
6 | |
7 | module.exports = function (argv) { |
8 | if (argv.help || argv._.length > 1) return require('./help')('issues') |
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