DenReg/cli/commands/setup.ts
2023-11-28 16:10:33 +01:00

30 lines
906 B
TypeScript

import { CliffyPrompt } from "../deps.ts";
import { getConfig, setConfig } from "../global.ts";
export default async function setup() {
const registry = await CliffyPrompt.Input.prompt({
message: "What's your registry?",
default: getConfig("registry"),
});
const username = await CliffyPrompt.Input.prompt({
message: "What's your username?",
default: getConfig("username"),
});
const password = await CliffyPrompt.Secret.prompt({
message: "What's your password?",
hidden: true,
default: getConfig("password"),
});
const author = await CliffyPrompt.Input.prompt({
message: "Who are you? (optional) Name <email@example.com>",
default: getConfig("author"),
});
await setConfig("registry", registry);
await setConfig("username", username);
await setConfig("password", password);
await setConfig("author", author);
}