summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorprzemyslawpluta <przemekpluta@hotmail.com>2014-09-29 23:58:54 +0100
committerprzemyslawpluta <przemekpluta@hotmail.com>2014-09-29 23:58:54 +0100
commit4ed25770687f068274959572e7fff05884c608bd (patch)
tree5442afd7732f6f11975fcade27e14ec6da0a9600 /lib
parentdcfbe1ed594e8d9ea9f049efa007500a6d19b5dc (diff)
downloadmongo-edu-4ed25770687f068274959572e7fff05884c608bd.zip
cleanup
Diffstat (limited to 'lib')
-rw-r--r--lib/options.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/options.js b/lib/options.js
index b549328..6dd1f72 100644
--- a/lib/options.js
+++ b/lib/options.js
@@ -136,7 +136,9 @@ function showPresets(argv, initRun, checkIfLoad) {
readFromPath(function read(err, data) {
if (err !== null) { return console.log('i'.red + ' No Presets Found.'); }
- var items = _.values(data), presets = _.keys(data), count = 0, t = new Table, i, names = [], clear = [];
+
+ var items = _.values(data), presets = _.keys(data), t = new Table,
+ count = 0, names = [], users = [], clear = [], info = false, user = '', i;
items.forEach(function each(item) {
t.cell('Preset', presets[count]);
@@ -155,6 +157,7 @@ function showPresets(argv, initRun, checkIfLoad) {
t.cell('Proxy', showSign(item.proxy));
t.cell('Proxy Test', showSign(item.test));
if (count === 0) { names = _.keys(t._row); }
+ users.push(item.u);
count = count + 1;
t.newRow();
});
@@ -165,12 +168,21 @@ function showPresets(argv, initRun, checkIfLoad) {
clear = clear.map(function map(item) { return names[item]; });
+ user = _.intersection(users);
+
+ if ((items.length > 1) && user.length === 1) {
+ clear = _.pull(clear, 'User');
+ info = true;
+ }
+
for (i = 0; i < t.rows.length; i++) {
t.rows[i] = _.pick(t.rows[i], clear);
}
t.columns = _.pick(t.columns, clear);
+ if (info) { console.log('User: '.bold + user[0] + '\n'); }
+
console.log(t.toString());
argv.load = true;