mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 07:33:12 +09:00
Port message types to TypeScript
This commit is contained in:
1 parent
15ea9a91dc
commit
2a52a82fb7
31 files changed
+2846
-4124
No files matched your search
+9
-2
@@ -83,7 +83,7 @@ class Control extends lib.Link {
|
||||
controller = false,
|
||||
hostIds = [],
|
||||
instanceIds = [],
|
||||
maxLevel = null,
|
||||
maxLevel = undefined,
|
||||
}) {
|
||||
await this.send(
|
||||
new lib.LogSetSubscriptionsRequest(
|
||||
@@ -286,7 +286,11 @@ async function startControl() {
|
||||
process.exitCode = 1;
|
||||
|
||||
} else if (err instanceof lib.RequestError) {
|
||||
logger.error(`Error sending request:\n${err.stack}`);
|
||||
if (err.stack) {
|
||||
logger.error(`Error sending request:\n${err.stack}`);
|
||||
} else {
|
||||
logger.error(`Error sending request: ${err.message}`);
|
||||
}
|
||||
process.exitCode = 1;
|
||||
|
||||
} else {
|
||||
@@ -315,6 +319,9 @@ I version of clusterio. Expect things to break. I
|
||||
`
|
||||
);
|
||||
startControl().catch(err => {
|
||||
if (err.errors) {
|
||||
logger.fatal(JSON.stringify(err.errors, null, 4));
|
||||
}
|
||||
if (!(err instanceof lib.StartupError)) {
|
||||
logger.fatal(`
|
||||
+------------------------------------------------------------+
|
||||
|
||||
@@ -237,9 +237,9 @@ hostCommands.add(new lib.Command({
|
||||
yargs.option("id", { type: "number", nargs: 1, describe: "Host id" });
|
||||
}],
|
||||
handler: async function(args, control) {
|
||||
let hostId = typeof args.id === "number" ? args.id : null;
|
||||
let hostId = typeof args.id === "number" ? args.id : undefined;
|
||||
let response = await control.send(new lib.HostGenerateTokenRequest(hostId));
|
||||
print(response.token);
|
||||
print(response);
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -480,9 +480,9 @@ instanceCommands.add(new lib.Command({
|
||||
}));
|
||||
|
||||
async function loadMapSettings(args) {
|
||||
let seed = args.seed !== undefined ? args.seed : null;
|
||||
let mapGenSettings = null;
|
||||
let mapSettings = null;
|
||||
let seed = args.seed;
|
||||
let mapGenSettings;
|
||||
let mapSettings;
|
||||
if (args.mapExchangeString) {
|
||||
let parsed = lib.readMapExchangeString(args.mapExchangeString);
|
||||
mapGenSettings = parsed.map_gen_settings;
|
||||
@@ -1551,7 +1551,7 @@ logCommands.add(new lib.Command({
|
||||
"controller": { describe: "Query log of the controller", nargs: 0, type: "boolean", default: false },
|
||||
"host": { describe: "Query log of given host", nargs: 1, type: "string", default: null },
|
||||
"instance": { describe: "Query log of given instance", nargs: 1, type: "string", default: null },
|
||||
"max-level": { describe: "Maximum log level to return", nargs: 1, type: "string", default: null },
|
||||
"max-level": { describe: "Maximum log level to return", nargs: 1, type: "string", default: undefined },
|
||||
"limit": { describe: "Max number of entries to return", nargs: 1, type: "number", default: 1000 },
|
||||
"start": { describe: "Limit from the start instead of the end", nargs: 0, type: "boolean", default: false },
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user