feat: add check server command

This commit is contained in:
Mauricio Siu
2024-06-03 21:55:29 -06:00
parent 85fd1f2c3e
commit de871490d7
27 changed files with 5907 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
import { Command, Flags } from "@oclif/core";
import * as fs from "node:fs";
import * as path from "node:path";
const configPath = path.join(__dirname, "..", "..", "config.json");
export default class Authenticate extends Command {
static description = "Authenticate the user by saving server URL and token";
static flags = {
token: Flags.string({
char: "t",
description: "Authentication token",
required: true,
}),
url: Flags.string({ char: "u", description: "Server URL", required: true }),
};
async run() {
const { flags } = await this.parse(Authenticate);
const config = {
token: flags.token,
url: flags.url,
};
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
this.log("Authentication details saved successfully.");
}
}