frontpage/lib/commands/types.tsx

29 lines
762 B
TypeScript
Raw Normal View History

2022-01-14 14:27:19 +01:00
import type { CommandInterface } from ".";
2022-06-21 18:44:20 +02:00
import type { Diary, Project } from "../content/types";
2022-01-14 14:27:19 +01:00
2021-12-17 18:55:00 +01:00
export interface Flag {
2021-12-16 00:21:14 +01:00
short: string;
long: string;
desc: string;
}
interface SubCommand {
name: string;
desc: string;
}
export interface Command {
name: string;
hidden?: boolean;
desc: string;
2021-12-17 20:02:42 +01:00
flags?: Record<string,Flag>;
subcommands?: Record<string,SubCommand>;
2022-01-14 14:27:19 +01:00
execute: (flags: string[], args: string[], raw: string, cmdIf: CommandInterface) => string[];
2021-12-16 00:21:14 +01:00
}
2022-06-21 18:44:20 +02:00
export interface CommandInterfaceCallbacks {
setModalVisible?: (visible: boolean) => void;
setModalContent?: (content: Project | Diary, selectedPage?: number) => void;
setModalHTML?: (html: any) => void;
getCmdHistory?: () => string[];
}