diff --git a/src/cli/cli-utils.ts b/src/cli/cli-utils.ts deleted file mode 100644 index 4e2e2f6..0000000 --- a/src/cli/cli-utils.ts +++ /dev/null @@ -1,45 +0,0 @@ -import util from "node:util"; - -/** - * Text formatting utilities for the CLI. - * - * Uses ANSI escape codes to format text. - * - * AI Generated links: - * @see https://en.wikipedia.org/wiki/ANSI_escape_code - * @see https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters - * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Colors - * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Formatting - * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Cursor_movement - * @see https://en.wikipedia.org/wiki/ANSI_escape_code#Screen_manipulation - */ - -const BOLD = "\x1b[1m"; -export const bold = (text: string) => `${BOLD}${text}${RESET}`; - -const DIM = "\x1b[2m"; -export const dim = (text: string) => `${DIM}${text}${RESET}`; - -const UNDERLINE = "\x1b[4m"; -export const underline = (text: string) => `${UNDERLINE}${text}${RESET}`; - -const INVERSE = "\x1b[7m"; -export const inverse = (text: string) => `${INVERSE}${text}${RESET}`; - -const HIDDEN = "\x1b[8m"; -export const hidden = (text: string) => `${HIDDEN}${text}${RESET}`; - -const STRIKETHROUGH = "\x1b[9m"; -export const strikethrough = (text: string) => - `${STRIKETHROUGH}${text}${RESET}`; - -const RESET = "\x1b[0m"; -export const reset = (text: string) => `${RESET}${text}${RESET}`; - -export const formatObject = (obj: unknown) => { - return util.inspect(obj, { - depth: null, - colors: true, - compact: false, - }); -}; diff --git a/src/cli/commands/invitation.ts b/src/cli/commands/invitation.ts index 4929329..6720a47 100644 --- a/src/cli/commands/invitation.ts +++ b/src/cli/commands/invitation.ts @@ -3,7 +3,7 @@ import path from "path"; import { generateTemplateIdentifier } from "@xo-cash/engine"; import { binToHex, hexToBin } from "@bitauth/libauth"; -import { bold, dim, formatObject } from "../cli-utils.js"; +import { bold, dim, formatObject } from "../utils.js"; import type { CommandDependencies, CommandIO } from "./types.js"; import { CommandError } from "./types.js"; import type { Invitation } from "../../services/invitation.js"; diff --git a/src/cli/commands/mnemonic.ts b/src/cli/commands/mnemonic.ts index 5c47d65..c1f7b87 100644 --- a/src/cli/commands/mnemonic.ts +++ b/src/cli/commands/mnemonic.ts @@ -1,4 +1,4 @@ -import { bold, dim } from "../cli-utils.js"; +import { bold, dim } from "../utils.js"; import { listMnemonicFiles, createMnemonicFile, diff --git a/src/cli/commands/receive.ts b/src/cli/commands/receive.ts index 8822bfb..c44e6f4 100644 --- a/src/cli/commands/receive.ts +++ b/src/cli/commands/receive.ts @@ -1,7 +1,7 @@ import { generateTemplateIdentifier } from "@xo-cash/engine"; import { hexToBin, lockingBytecodeToCashAddress } from "@bitauth/libauth"; -import { bold, dim } from "../cli-utils.js"; +import { bold, dim } from "../utils.js"; import type { CommandDependencies, CommandIO } from "./types.js"; import { CommandError } from "./types.js"; diff --git a/src/cli/commands/resource.ts b/src/cli/commands/resource.ts index 49feead..a1d94ee 100644 --- a/src/cli/commands/resource.ts +++ b/src/cli/commands/resource.ts @@ -1,6 +1,6 @@ import { hexToBin } from "@bitauth/libauth"; -import { bold, dim } from "../cli-utils.js"; +import { bold, dim } from "../utils.js"; import type { CommandDependencies, CommandIO } from "./types.js"; import type { UnspentOutputData } from "@xo-cash/state"; import { CommandError } from "./types.js"; diff --git a/src/cli/commands/template.ts b/src/cli/commands/template.ts index 6ce0187..9391e95 100644 --- a/src/cli/commands/template.ts +++ b/src/cli/commands/template.ts @@ -3,7 +3,7 @@ import path from "path"; import { generateTemplateIdentifier } from "@xo-cash/engine"; import type { XOTemplate } from "@xo-cash/types"; -import { bold, dim, formatObject } from "../cli-utils.js"; +import { bold, dim, formatObject } from "../utils.js"; import { resolveTemplateReferences } from "../../utils/templates.js"; import type { CommandDependencies, CommandIO } from "./types.js"; import { CommandError } from "./types.js"; diff --git a/src/cli/index.ts b/src/cli/index.ts index 93cca80..2b0ff7f 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -40,7 +40,7 @@ import { join } from "path"; import { AppService } from "../services/app.js"; import { convertArgsToObject } from "./arguments.js"; -import { bold, dim, formatObject } from "./cli-utils.js"; +import { bold, dim, formatObject } from "./utils.js"; import { listGlobalMnemonicFiles, loadMnemonic } from "./mnemonic.js"; import { getDataDir,