@fragment-dev/cli
Version:
42 lines (39 loc) • 966 B
JavaScript
import {
AuthenticatedCommand
} from "./chunk-W7HG2VEH.js";
import {
require_source
} from "./chunk-M5OAS5QZ.js";
import {
__toESM,
init_cjs_shims
} from "./chunk-7GH3YGSC.js";
// src/commands/token.ts
init_cjs_shims();
var import_chalk = __toESM(require_source(), 1);
import { AssertionError } from "node:assert";
var Token = class extends AuthenticatedCommand {
static {
this.summary = "Get a FRAGMENT Authentication Token.";
}
static {
this.examples = ["<%= config.bin %> <%= command.id %>"];
}
static {
this.help = "Create an API client at dashboard.fragment.dev/api-clients";
}
async run() {
try {
await this.loadFragmentAuthConfigFromDisk();
} catch (err) {
if (!(err instanceof AssertionError)) {
throw err;
}
this.log("Malformed credentials found. Re-authenticating...");
}
this.log(import_chalk.default.greenBright(this.authToken.access_token));
}
};
export {
Token
};