Commit 5f2aabf4bd31988b96a0669ba348f953d0658862
add 'branch' command, which returns metadata about a record
ansuz committed on 11/3/2016, 9:00:24 PMParent: 29028b33c40e7f71c6075b33c3549b10dcb4bf06
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -7,20 +7,21 @@ | ||
7 | 7 … | |
8 | 8 … | (function () { |
9 | 9 … | if (require.main !== module) { return module.exports = Lib; } |
10 | 10 … | |
11 | -var publishHelp = "\tssb-dns publish (previous record key...) name type value (class)"; | |
12 | -var updateHelp = "\tssb-dns update name type value (class)"; | |
13 | -var serverHelp = "\tssb-dns server port host"; | |
14 | -var dumpHelp = "\tssb-dns dump"; | |
11 … | +var publishHelp = "\tdnssb publish (previous record key...) name type value (class)"; | |
12 … | +var updateHelp = "\tdnssb update name type value (class)"; | |
13 … | +var branchHelp = "\tdnssb branch name type (class)"; | |
14 … | +var serverHelp = "\tdnssb server port host"; | |
15 … | +var dumpHelp = "\tdnssb dump"; | |
15 | 16 … | |
16 | - | |
17 | 17 … | var CLI_Help = function () { |
18 | 18 … | [ |
19 | 19 … | "try one of:", |
20 | 20 … | serverHelp, |
21 | 21 … | publishHelp, |
22 | 22 … | updateHelp, |
23 … | + branchHelp, | |
23 | 24 … | dumpHelp, |
24 | 25 … | ].forEach(function (m) { |
25 | 26 … | console.log(m); |
26 | 27 … | }); |
@@ -109,8 +110,35 @@ | ||
109 | 110 … | }); |
110 | 111 … | }) |
111 | 112 … | }()); |
112 | 113 … | break; |
114 … | + | |
115 … | + | |
116 … | + case 'branch': | |
117 … | + (function () { | |
118 … | + if (argv.length < 3) { | |
119 … | + console.log("Try:"); | |
120 … | + console.error(branchHelp); | |
121 … | + return; | |
122 … | + } | |
123 … | + | |
124 … | + var name = argv[1]; | |
125 … | + var type = argv[2]; | |
126 … | + var _class = argv[3]; | |
127 … | + | |
128 … | + Lib.query.branches(name, type, _class, function (err, branches) { | |
129 … | + if (!branches.length) { | |
130 … | + console.error("No branches found"); | |
131 … | + process.exit(1); | |
132 … | + } | |
133 … | + branches.forEach(function (branch) { | |
134 … | + console.log(branch); | |
135 … | + }); | |
136 … | + | |
137 … | + process.exit(0); | |
138 … | + }); | |
139 … | + }()); | |
140 … | + break; | |
113 | 141 … | default: |
114 | 142 … | CLI_Help(); |
115 | 143 … | break; |
116 | 144 … | } |
Built with git-ssb-web