CodeSnap

Command Output

Learn how to use the command output feature in your application

Command Output

Learn how to use the command output feature in your application.

Basic Usage

import { CommandOutput } from '@your-package-name'
 
function App() {
  return (
    <CommandOutput
      command="npm install"
      output={output}
      status="success"
    />
  )
}

Features

  • Command execution status
  • Real-time output streaming
  • Error handling
  • Command history
  • Output formatting

Configuration Options

const config = {
  showCommand: true,
  showTimestamp: true,
  autoScroll: true,
  maxHistory: 100,
  theme: 'terminal'
}

Output Types

  1. Success Output

    $ npm install
    added 1234 packages in 5.2s
  2. Error Output

    $ npm install
    npm ERR! code E404
    npm ERR! 404 Not Found
  3. Progress Output

    $ npm install
    [==========] 100% | ETA: 0s | 1234/1234

Advanced Features

Custom Command Handlers

import { registerCommandHandler } from '@your-package-name'
 
registerCommandHandler('custom', {
  execute: async (command) => {
    // Custom command execution logic
    return result
  }
})

Output Themes

const terminalTheme = {
  name: 'custom-terminal',
  colors: {
    background: '#1E1E1E',
    text: '#FFFFFF',
    success: '#4CAF50',
    error: '#F44336',
    command: '#2196F3'
  }
}

On this page