aggregate muxrpc-usage help
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (sbot, cb) { | |
var help = null | |
sbot.help(function (err, data) { | |
if(!data.type) data.type = 'group' | |
help = data | |
var keys = Object.keys(sbot) | |
var n = keys.length + 1 | |
keys.forEach(function (key) { | |
if(sbot[key] && 'function' === typeof sbot[key].help) | |
sbot[key].help(function (err, data) { | |
if(!data.type) data.type = 'group' | |
help.commands[key] = data | |
done() | |
}) | |
else --n | |
}) | |
done() | |
function done (err) { | |
if(--n) return | |
cb(null, help) | |
} | |
}) | |
} | |
if(!module.parent) | |
require('ssb-client')(function (err, rpc) { | |
if(err) throw err | |
module.exports(rpc, function (err, data) { | |
console.log(JSON.stringify(data, null, 2)) | |
rpc.close() | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am really impressed with the topics you share, I will visit your posts more often. nytimes crossword