Add oputil mb list-confs, update with prettier

This commit is contained in:
Bryan Ashby
2023-05-11 08:40:53 -06:00
parent 97cd0c3063
commit 6ff7d1f545
3 changed files with 42 additions and 24 deletions

View File

@@ -182,6 +182,8 @@ General Information:
MessageBase: `usage: oputil.js mb <action> [<arguments>]
Actions:
list-confs List conferences and areas
areafix CMD1 CMD2 ... ADDR Sends an AreaFix NetMail
NetMail is sent to supplied address with the supplied command(s). Multi-part commands
@@ -194,6 +196,9 @@ Actions:
packet in the directory specified by PATH. The QWK
BBS ID will be obtained by the final component of PATH.
list-confs arguments:
--areas Include areas within each message conference.
import-areas arguments:
--conf CONF_TAG Conference tag in which to import areas
--network NETWORK Network name/key to associate FTN areas

View File

@@ -692,6 +692,30 @@ function exportQWKPacket() {
);
}
const listConferences = () => {
initConfigAndDatabases(err => {
if (err) {
return console.error(err.reason ? err.reason : err.message);
}
const { getSortedAvailMessageConferences } = require('../../core/message_area');
const conferences = getSortedAvailMessageConferences(null, { noClient: true });
for (let conf of conferences) {
console.info(`${conf.confTag} - ${conf.conf.name}`);
if (!argv.areas) {
continue;
}
for (let areaTag of Object.keys(conf.conf.areas)) {
console.info(` ${areaTag} - ${conf.conf.areas[areaTag].name}`);
}
}
});
};
function handleMessageBaseCommand() {
function errUsage() {
return printUsageAndSetExitCode(getHelpFor('MessageBase'), ExitCodes.ERROR);
@@ -709,6 +733,7 @@ function handleMessageBaseCommand() {
'import-areas': importAreas,
'qwk-dump': dumpQWKPacket,
'qwk-export': exportQWKPacket,
'list-confs': listConferences,
}[action] || errUsage
)();
}