git ssb

39+

cel / git-ssb



Tree: 9879cbb757d4bcde4e81cb784c35900a61a22bd6

Files: 9879cbb757d4bcde4e81cb784c35900a61a22bd6 / lib / name.js

904 bytesRaw
1var u = require('./util')
2
3exports.help = `
4Usage: git ssb name [<repo>] <name>
5
6 Publish a name for a git-ssb repo
7
8Arguments:
9 repo id, url, or git remote name of the base repo.
10 default: 'origin' or 'ssb'
11 name the name to give the repo
12`
13
14exports.fn = function (argv) {
15 if (argv._.length < 1 || argv._.length > 2) return u.help('name')
16
17 var repo
18 if (argv._.length == 1) repo = u.getRemote()
19 else if (argv._.length == 2) repo = u.getRemote(argv._.shift())
20 if (!repo) throw 'unable to find git-ssb repo'
21 var name = argv._[0]
22 if (!name) throw 'missing name'
23
24 u.getSbot(argv, function (err, sbot) {
25 if (err) throw err
26 var schemas = require('ssb-msg-schemas')
27 var value = schemas.name(repo, name)
28 u.publishToSameRecps(sbot, repo, value, function (err, msg) {
29 if (err) throw err
30 console.log(msg.key)
31 sbot.close()
32 })
33 })
34}
35
36

Built with git-ssb-web