Files
factorio-clusterio/test/file/test_plugin/ctl.js
T
Hornwitser 5df5af7ca8 Rename Ctl's usage of "control" to "ctl" (#1039)
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.
2026-09-14 20:18:41 +02:00

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);
}
}