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.
This commit is contained in:
Hornwitser authored and GitHub committed 2026-09-14 20:18:41 +02:00
1 parent 1d1d9bb1c4
commit 5df5af7ca8
35 files changed
+383 -383

No files matched your search

+12 -12
View File
@@ -2,7 +2,7 @@ import asTableModule from "as-table";
import * as lib from "@clusterio/lib";
import { logger } from "@clusterio/lib";
import type { Control } from "../ctl.js";
import type { Ctl } from "../ctl.js";
import { print } from "./command_ops.js";
const asTable = asTableModule.configure({ delimiter: " | " });
@@ -10,8 +10,8 @@ const asTable = asTableModule.configure({ delimiter: " | " });
export const roleCommands = new lib.CommandTree({ name: "role", description: "Role management" });
roleCommands.add(new lib.Command({
definition: [["list", "l"], "List roles in the cluster"],
handler: async function(args: object, control: Control) {
let roles = await control.send(new lib.RoleListRequest());
handler: async function(args: object, ctl: Ctl) {
let roles = await ctl.send(new lib.RoleListRequest());
print(asTable(roles));
},
}));
@@ -24,8 +24,8 @@ roleCommands.add(new lib.Command({
"permissions": { describe: "Permissions role grants", nargs: 1, array: true, type: "string", default: [] },
});
}],
handler: async function(args: { name: string, description: string, permissions: string[] }, control: Control) {
let id = await control.send(new lib.RoleCreateRequest(
handler: async function(args: { name: string, description: string, permissions: string[] }, ctl: Ctl) {
let id = await ctl.send(new lib.RoleCreateRequest(
args.name,
args.description,
args.permissions,
@@ -58,9 +58,9 @@ roleCommands.add(new lib.Command({
removePerms?: string[],
grantDefault?: boolean,
},
control: Control
ctl: Ctl
) {
let role = await lib.retrieveRole(control, args.role);
let role = await lib.retrieveRole(ctl, args.role);
if (args.name !== undefined) {
role.name = args.name;
@@ -81,10 +81,10 @@ roleCommands.add(new lib.Command({
if (args.setPerms !== undefined) {
role.permissions = new Set(args.setPerms);
}
await control.send(new lib.RoleUpdateRequest(role.id, role.name, role.description, [...role.permissions]));
await ctl.send(new lib.RoleUpdateRequest(role.id, role.name, role.description, [...role.permissions]));
if (args.grantDefault) {
await control.send(new lib.RoleGrantDefaultPermissionsRequest(role.id));
await ctl.send(new lib.RoleGrantDefaultPermissionsRequest(role.id));
}
},
}));
@@ -93,8 +93,8 @@ roleCommands.add(new lib.Command({
definition: ["delete <role>", "Delete role", (yargs) => {
yargs.positional("role", { describe: "Role to delete", type: "string" });
}],
handler: async function(args: { role: string }, control: Control) {
let role = await lib.retrieveRole(control, args.role);
await control.send(new lib.RoleDeleteRequest(role.id));
handler: async function(args: { role: string }, ctl: Ctl) {
let role = await lib.retrieveRole(ctl, args.role);
await ctl.send(new lib.RoleDeleteRequest(role.id));
},
}));