fix some syntax and stuff
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { apiClient } from "../core/api-client";
|
||||
import { logError, logInfo } from "./logger";
|
||||
import * as readline from "node:readline";
|
||||
import { apiClient } from "../core/api-client.ts";
|
||||
import { logError, logInfo } from "./logger.ts";
|
||||
|
||||
export async function getUserId(username: string): Promise<string | null> {
|
||||
const user = await apiClient.users.getUserByName(username);
|
||||
@@ -10,3 +11,17 @@ export async function getUserId(username: string): Promise<string | null> {
|
||||
logError(`no user with name ${username} found`);
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function promptForInput(prompt: string): Promise<string> {
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
return new Promise<string>((resolve) => {
|
||||
rl.question(prompt, (answer) => {
|
||||
rl.close();
|
||||
resolve(answer.trim());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user