mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-08-28 13:24:04 +00:00
Always show help commands.
The interface-manager is still a little bit fragile if you give keywords to the help command.
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
TopPresentationSchema,
|
||||
describeCommand,
|
||||
} from "@the-draupnir-project/interface-manager";
|
||||
import { ActionResult, Ok, isError } from "matrix-protection-suite";
|
||||
import { ActionResult, Ok } from "matrix-protection-suite";
|
||||
import { MatrixAdaptorContext } from "../../commands/interface-manager/MPSMatrixInterfaceAdaptor";
|
||||
import { AppserviceBotCommands } from "./AppserviceBotCommandTable";
|
||||
import { renderTableHelp } from "../../commands/interface-manager/MatrixHelpRenderer";
|
||||
@@ -33,13 +33,8 @@ export const AppserviceBotHelpCommand = describeCommand({
|
||||
parameters: [],
|
||||
});
|
||||
|
||||
function renderAppserviceBotHelp(
|
||||
appserviceBotCommands: Result<CommandTable>
|
||||
): Result<DocumentNode> {
|
||||
if (isError(appserviceBotCommands)) {
|
||||
return appserviceBotCommands;
|
||||
}
|
||||
return Ok(<root>{renderTableHelp(appserviceBotCommands.ok)}</root>);
|
||||
function renderAppserviceBotHelp(): Result<DocumentNode> {
|
||||
return Ok(<root>{renderTableHelp(AppserviceBotCommands)}</root>);
|
||||
}
|
||||
|
||||
AppserviceBotInterfaceAdaptor.describeRenderer(AppserviceBotHelpCommand, {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// https://github.com/matrix-org/mjolnir
|
||||
// </text>
|
||||
|
||||
import { Ok, isError } from "matrix-protection-suite";
|
||||
import { Ok } from "matrix-protection-suite";
|
||||
import {
|
||||
CommandTable,
|
||||
DocumentNode,
|
||||
@@ -38,13 +38,7 @@ export const DraupnirHelpCommand = describeCommand({
|
||||
});
|
||||
|
||||
DraupnirInterfaceAdaptor.describeRenderer(DraupnirHelpCommand, {
|
||||
JSXRenderer(result) {
|
||||
if (isError(result)) {
|
||||
throw new TypeError(
|
||||
`We should always be able to get the base command table`
|
||||
);
|
||||
} else {
|
||||
return Ok(renderDraupnirHelp(result.ok));
|
||||
}
|
||||
JSXRenderer() {
|
||||
return Ok(renderDraupnirHelp(DraupnirTopLevelCommands));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
TopPresentationSchema,
|
||||
CommandTable,
|
||||
} from "@the-draupnir-project/interface-manager";
|
||||
import { Ok, isError } from "matrix-protection-suite";
|
||||
import { Ok } from "matrix-protection-suite";
|
||||
import { renderTableHelp } from "../../commands/interface-manager/MatrixHelpRenderer";
|
||||
import { safeModeHeader } from "./StatusCommand";
|
||||
|
||||
@@ -32,14 +32,11 @@ export const SafeModeHelpCommand = describeCommand({
|
||||
});
|
||||
|
||||
SafeModeInterfaceAdaptor.describeRenderer(SafeModeHelpCommand, {
|
||||
JSXRenderer(result) {
|
||||
if (isError(result)) {
|
||||
throw new TypeError("This should never fail");
|
||||
}
|
||||
JSXRenderer() {
|
||||
return Ok(
|
||||
<root>
|
||||
{safeModeHeader()}
|
||||
{renderTableHelp(result.ok)}
|
||||
{renderTableHelp(SafeModeCommands)}
|
||||
</root>
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user