mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-01 21:30:30 +01:00
feat: #9173, show installed plugin versions in ./nodebb plugins
This commit is contained in:
@@ -77,7 +77,7 @@ async function listPlugins() {
|
||||
const active = await db.getSortedSetRange('plugins:active', 0, -1);
|
||||
|
||||
// Merge the two sets, defer to plugins in `installed` if already present
|
||||
let combined = installed.concat(active.reduce((memo, cur) => {
|
||||
const combined = installed.concat(active.reduce((memo, cur) => {
|
||||
if (!installedList.includes(cur)) {
|
||||
memo.push({
|
||||
id: cur,
|
||||
@@ -90,12 +90,12 @@ async function listPlugins() {
|
||||
}, []));
|
||||
|
||||
// Alphabetical sort
|
||||
combined = combined.sort((a, b) => (a.id > b.id ? 1 : -1));
|
||||
combined.sort((a, b) => (a.id > b.id ? 1 : -1));
|
||||
|
||||
// Pretty output
|
||||
process.stdout.write('Active plugins:\n');
|
||||
combined.forEach((plugin) => {
|
||||
process.stdout.write('\t* ' + plugin.id + ' (');
|
||||
process.stdout.write('\t* ' + plugin.id + (plugin.version ? '@' + plugin.version : '') + ' (');
|
||||
process.stdout.write(plugin.installed ? 'installed'.green : 'not installed'.red);
|
||||
process.stdout.write(', ');
|
||||
process.stdout.write(plugin.active ? 'enabled'.green : 'disabled'.yellow);
|
||||
|
||||
Reference in New Issue
Block a user