(name, completer, cb)
| 135 | } |
| 136 | |
| 137 | function install(name, completer, cb) { |
| 138 | var markerIn = '###-begin-' + name + '-completion-###', |
| 139 | markerOut = '###-end-' + name + '-completion-###'; |
| 140 | |
| 141 | var rc, scriptOutput; |
| 142 | |
| 143 | readRc(completer, function(err, file) { |
| 144 | if(err) return cb(err); |
| 145 | |
| 146 | var part = file.split(markerIn)[1]; |
| 147 | if(part) { |
| 148 | return cb(null, ' ✗ ' + completer + ' tab-completion has been already installed. Do nothing.'); |
| 149 | } |
| 150 | |
| 151 | rc = file; |
| 152 | next(); |
| 153 | }); |
| 154 | |
| 155 | script(name, completer, function(err, file) { |
| 156 | scriptOutput = file; |
| 157 | next(); |
| 158 | }); |
| 159 | |
| 160 | function next() { |
| 161 | if(!rc || !scriptOutput) return; |
| 162 | |
| 163 | writeRc(rc + scriptOutput, function(err) { |
| 164 | if(err) return cb(err); |
| 165 | return cb(null, ' ✓ ' + completer + ' tab-completion installed.'); |
| 166 | }); |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | function uninstall(name, completer, cb) { |
| 171 | var markerIn = '\n\n###-begin-' + name + '-completion-###', |
no test coverage detected
searching dependent graphs…