Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

916 B
Raw Blame
import { getConfig } from "@/utils/config";
import { handleError } from "@/utils/handle-error";
import { logger } from "@/utils/logger";
import { Command } from "commander";
import colorizeJson from "json-colorizer";
import ora from "ora";

export const config = new Command()
  .name("config")
  .description("See your configured credentials")
  .action(async () => {
    const spinner = ora("Getting config").start();

    try {
      const configInfo = await getConfig();
      spinner.succeed("Configuration file successfully retrieved");

      logger.info("");
      console.log(
        colorizeJson(JSON.stringify(configInfo, null, 2), {
          colors: {
            STRING_KEY: "white",
            STRING_LITERAL: "#65B741",
            NUMBER_LITERAL: "#7E30E1",
          },
        }),
      );
      logger.info("");
    } catch (error) {
      spinner.stop();
      handleError(error);
    }
  });