DenReg/cli/commands/setup.ts

30 lines
906 B
TypeScript
Raw Normal View History

2023-11-28 15:10:33 +00:00
import { CliffyPrompt } from "../deps.ts";
2020-07-28 17:43:58 +00:00
import { getConfig, setConfig } from "../global.ts";
export default async function setup() {
2023-11-28 15:10:33 +00:00
const registry = await CliffyPrompt.Input.prompt({
2020-07-28 17:43:58 +00:00
message: "What's your registry?",
default: getConfig("registry"),
});
2023-11-28 15:10:33 +00:00
const username = await CliffyPrompt.Input.prompt({
2020-07-28 17:43:58 +00:00
message: "What's your username?",
default: getConfig("username"),
});
2023-11-28 15:10:33 +00:00
const password = await CliffyPrompt.Secret.prompt({
2020-07-28 17:43:58 +00:00
message: "What's your password?",
hidden: true,
default: getConfig("password"),
});
2023-11-28 15:10:33 +00:00
const author = await CliffyPrompt.Input.prompt({
2020-07-28 17:43:58 +00:00
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);
}