mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Ctl ended up calling its main class for "Control" for historical
reasons, along with its config file and plugin entrypoint.
The plugin entrypoint was renamed to ctl in 808eda0513. This
finishes that renaming by also renaming the main class, default config
file, config-control command, and main entrypoint.
The config-control command is renamed to config to be consistent with
the host and controller's config commands.
The term "control" is still kept in the config and message locations as
a common specifier for both ctl and web_ui.
22 lines
656 B
JavaScript
22 lines
656 B
JavaScript
import { Command, CommandTree } from "@clusterio/lib";
|
|
import { BaseCtlPlugin } from "@clusterio/ctl";
|
|
|
|
const testPluginCommands = new CommandTree({
|
|
name: "test-plugin", description: "Test plugin commands",
|
|
});
|
|
testPluginCommands.add(new Command({
|
|
definition: ["echo <message>", "Print the message given to it", (yargs) => {
|
|
yargs.positional("message", { describe: "message to print", type: "string" });
|
|
}],
|
|
handler: async function(args, ctl) {
|
|
// eslint-disable-next-line no-console
|
|
console.log(args.message);
|
|
},
|
|
}));
|
|
|
|
export class CtlPlugin extends BaseCtlPlugin {
|
|
async addCommands(rootCommand) {
|
|
rootCommand.add(testPluginCommands);
|
|
}
|
|
}
|