mirror of
https://github.com/thelounge/thelounge.git
synced 2026-03-14 22:45:50 +01:00
Changes: - `no-var-requires` replaced by `no-require-imports` (typescript-eslint/typescript-eslint#8334) - `restrict-template-expressions` does not trigger for `Error` (typescript-eslint/typescript-eslint#8556) - `only-throw-error` and `prefer-promise-reject-errors` recommended (typescript-eslint/typescript-eslint#9079) - fixed `no-base-to-string` in client/js/upload.ts - fixed `no-unsafe-enum-comparison` in client/js/store.ts - fixed `await-thenable` in test/client/js/helpers/parse.ts - fixed `no-empty-object-type` in client/shims-vue.d.ts and shared/types/socket-events.d.ts See <https://typescript-eslint.io/blog/announcing-typescript-eslint-v8/>
34 lines
928 B
TypeScript
34 lines
928 B
TypeScript
import log from "../../log";
|
|
import colors from "chalk";
|
|
import {Command} from "commander";
|
|
import fs from "fs";
|
|
import Config from "../../config";
|
|
import Utils from "../utils";
|
|
|
|
const program = new Command("remove");
|
|
program
|
|
.description("Remove an existing user")
|
|
.on("--help", Utils.extraHelp)
|
|
.argument("<name>", "name of the user")
|
|
.action(function (name) {
|
|
if (!fs.existsSync(Config.getUsersPath())) {
|
|
log.error(`${Config.getUsersPath()} does not exist.`);
|
|
return;
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
const ClientManager = require("../../clientManager").default;
|
|
const manager = new ClientManager();
|
|
|
|
try {
|
|
if (manager.removeUser(name)) {
|
|
log.info(`User ${colors.bold(name)} removed.`);
|
|
} else {
|
|
log.error(`User ${colors.bold(name)} does not exist.`);
|
|
}
|
|
} catch (e: any) {
|
|
// There was an error, already logged
|
|
}
|
|
});
|
|
|
|
export default program;
|