MCPcopy
hub / github.com/Unitech/pm2 / install

Function install

lib/completion.js:137–168  ·  view source on GitHub ↗
(name, completer, cb)

Source from the content-addressed store, hash-verified

135}
136
137function 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
170function uninstall(name, completer, cb) {
171 var markerIn = '\n\n###-begin-' + name + '-completion-###',

Callers 1

completion.jsFile · 0.70

Calls 4

readRcFunction · 0.85
cbFunction · 0.85
scriptFunction · 0.85
nextFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…