UNPKG

@visionfi/server-cli

Version:

Command-line interface for VisionFI Server SDK

76 lines (75 loc) 1.65 kB
/** * Display utilities for VisionFI CLI * Copyright (c) 2024-2025 VisionFI. All Rights Reserved. */ import chalk from 'chalk'; import ora from 'ora'; export class Display { /** * Display data as formatted JSON */ static json(data, pretty = true) { if (pretty) { console.log(JSON.stringify(data, null, 2)); } else { console.log(JSON.stringify(data)); } } /** * Display data as a table */ static table(data) { console.table(data); } /** * Display success message */ static success(message) { console.log(chalk.green('✓'), message); } /** * Display error message */ static error(message) { console.error(chalk.red('✗'), message); } /** * Display warning message */ static warning(message) { console.warn(chalk.yellow('⚠'), message); } /** * Display info message */ static info(message) { console.log(chalk.blue('ℹ'), message); } /** * Create a spinner for long-running operations */ static spinner(message) { return ora(message).start(); } /** * Display a header */ static header(title) { console.log(); console.log(chalk.bold.underline(title)); console.log(); } /** * Display key-value pairs */ static keyValue(key, value) { console.log(`${chalk.bold(key + ':')} ${value}`); } /** * Display a list */ static list(items) { items.forEach(item => console.log(` • ${item}`)); } }