var u = require('./util') exports.help = ` Usage: git ssb name [] Publish a name for a git-ssb repo Arguments: repo id, url, or git remote name of the base repo. default: 'origin' or 'ssb' name the name to give the repo ` exports.fn = function (argv) { if (argv._.length < 1 || argv._.length > 2) return u.help('name') var repo if (argv._.length == 1) repo = u.getRemote() else if (argv._.length == 2) repo = u.getRemote(argv._.shift()) if (!repo) throw 'unable to find git-ssb repo' var name = argv._[0] if (!name) throw 'missing name' u.getSbot(argv, function (err, sbot) { if (err) throw err var schemas = require('ssb-msg-schemas') var value = schemas.name(repo, name) u.publishToSameRecps(sbot, repo, value, function (err, msg) { if (err) throw err console.log(msg.key) sbot.close() }) }) }