Commit ba23b4dc authored by Hasang Cho's avatar Hasang Cho
Browse files

feat(mod.ts, deno.json): Check if stdout is a terminal and disable color output if not

- add @std/fmt/colors in deno.json
parent f748fcc5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
    "@jimp/wasm-webp": "npm:@jimp/wasm-webp@^1.6.0",
    "@poppanator/http-constants": "npm:@poppanator/http-constants@^1.1.1",
    "@std/assert": "jsr:@std/assert@^1.0.13",
    "@std/fmt/colors": "jsr:@std/fmt/colors",
    "@std/dotenv": "jsr:@std/dotenv@^0.225.2",
    "@std/assert": "jsr:@std/assert@^1.0.0",
    "@std/semver": "jsr:@std/semver@^1.0.5",
+5 −0
Original line number Diff line number Diff line
import { Command, CompletionsCommand, HelpCommand } from "@cliffy/command";
import { getFileSink } from "@logtape/file";
import { configure, getConsoleSink } from "@logtape/logtape";
import { setColorEnabled } from "@std/fmt/colors";
import { AsyncLocalStorage } from "node:async_hooks";
import { DEFAULT_CACHE_DIR, setCacheDir } from "./cache.ts";
import metadata from "./deno.json" with { type: "json" };
@@ -12,9 +13,13 @@ import { command as nodeinfo } from "./nodeinfo.ts";
import { command as tunnel } from "./tunnel.ts";
import { command as webfinger } from "./webfinger.ts";

const colorEnabled = Deno.stdout.isTerminal();
setColorEnabled(colorEnabled);

const command = new Command()
  .name("fedify")
  .version(metadata.version)
  .help({ colors: colorEnabled })
  .globalEnv(
    "FEDIFY_LOG_FILE=<file:file>",
    "An optional file to write logs to.  " +