Files: 873ff04e1eef1fb6e86d5e48cbaf0da8e8ac7dfe / lib / name.js
631 bytesRaw
1 | var u = require('./util') |
2 | |
3 | module.exports = function (argv) { |
4 | if (argv._.length < 1 || argv._.length > 2) return require('./help')(argv) |
5 | |
6 | var repo |
7 | if (argv._.length == 1) repo = u.getRemote() |
8 | else if (argv._.length == 2) repo = u.getRemote(argv._.shift()) |
9 | if (!repo) throw 'unable to find git-ssb repo' |
10 | var name = argv._[0] |
11 | if (!name) throw 'missing name' |
12 | |
13 | u.getSbot(argv, function (err, sbot) { |
14 | if (err) throw err |
15 | var schemas = require('ssb-msg-schemas') |
16 | sbot.publish(schemas.name(repo, name), function (err, msg) { |
17 | if (err) throw err |
18 | console.log(msg.key) |
19 | sbot.close() |
20 | }) |
21 | }) |
22 | } |
23 | |
24 |
Built with git-ssb-web