Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, function(done) {
CORE.println("Email:");
CORE.prompt(function(err, value) {
if (err) return done(err);
email = value.slice(0,-1);
if ((email.length===0) || (email.indexOf('@')<0)) {
return done("Must provide valid email");
}
return done();
});
// get password
}, function(done) {
CORE.println("Password:");
CORE.prompt(function(err, response) {
CORE.prompt.done();
response = Number(response);
if (isNaN(response)) return CORE.println('Invalid Response');
if (response > last) return done(); // skip
// remove only one if single version selected
if (response < last) versions = [versions[response-1]];
CORE.iter.each(versions, function(pkg, done) {
repo.remove(pkg, done);
})(done);
});
// make sure the package is not under source control
isUnderSourceControl = SRC_DIRS.some(function(dirname) {
return CORE.fs.exists(CORE.path.join(pkg.path, dirname));
});
if (isUnderSourceControl) {
if (!force) {
return done(new Error(packageId+' is under source control. Use --force to override'));
} else {
CORE.verbose(packageId+" is under source control. Removing anyway");
}
}
CORE.verbose("Removing "+pkg.path);
CORE.fs.rm_r(pkg.path);
CORE.println("Unfroze "+packageId);
return done();
};
}
}, function(done) {
CORE.println("Password:");
CORE.prompt(function(err, value) {
if (err) return done(err);
password = value.slice(0,-1);
if (password.length===0) return done("password cannot be empty");
return done();
});
// create account
}, function(done) {
CORE.prompt.done(); // no more data required
// skip uninstalled versions
if (!versions || (versions.length===0)) {
if (vers) packageId = packageId + ' ' + vers;
return Cmds.fail(packageId + ' is not installed', done);
// one version is installed - just uninstall it
} else if (versions.length===1) {
pkg = versions[0];
Cmds.verbose('removing ', packageId,' version: ', pkg.get('version'));
repo.remove(pkg, done);
// prompt for removal
} else {
CORE.println("Remove which version of " + packageId + "?");
for(var idx=0;idx1 ? 'Skip this package' : 'Cancel remove'));
CORE.prompt(function(err, response) {
CORE.prompt.done();
response = Number(response);
if (isNaN(response)) return CORE.println('Invalid Response');
if (response > last) return done(); // skip
// remove only one if single version selected
if (response < last) versions = [versions[response-1]];
CORE.iter.each(versions, function(pkg, done) {
exports.show = function(cmd, args, state, done) {
var remotes = REMOTE.config();
if (remotes.length===0) {
CORE.println('(No remotes)');
} else {
remotes.forEach(function(remote) {
CORE.println(remote.url + ' ('+remote.plugin+')');
});
}
};
if (!packages[packageName]) packages[packageName] = [];
packages[packageName].push(pkg);
});
for(packageName in packages) {
if (!packages.hasOwnProperty(packageName)) continue;
if (args.length>0 && args.indexOf(packageName)<0) continue;
versions = packages[packageName];
versions = versions.sort(semverSort);
line = details ? showDetails(versions) : showSummary(versions);
CORE.println(line);
}
} else {
CORE.println('(No packages)');
}
return done();
};
if (!indent) indent = '';
if (obj===undefined) return;
if (isHash(obj)) {
CORE.println('');
for(key in obj) {
if (!obj.hasOwnProperty(key)) continue;
v = obj[key];
CORE.print(indent+key+': ');
if (isHash(v) || isArray(v)) {
pp(v, indent+' ');
} else {
CORE.println(v);
}
}
} else if (isArray(obj)) {
if (obj.some(function(x) { return isHash(x) || isArray(x); })) {
obj.forEach(function(x) {
pp(x, indent+' ');
CORE.println('');
});
} else {
CORE.print(obj.join(', '));
}
} else {
CORE.println(indent+obj);
}
}
obj.forEach(function(x) {
pp(x, indent+' ');
CORE.println('');
});
} else {
CORE.fs.exec(cmd, true, function(err) {
if (err) return done(err);
CORE.println("Forked package "+packageId);
return done();
});
});