Skip to main content

Crate csh

Crate csh 

Source
Expand description

color-ssh (csh) - A Rust-based SSH client wrapper with syntax highlighting

This library provides the core functionality for the color-ssh tool, which wraps SSH connections with syntax highlighting and enhanced logging capabilities.

§Features

  • Syntax Highlighting: Apply ANSI color codes to SSH output based on regex patterns
  • Configuration Management: YAML-based configuration with hot-reloading
  • Logging: Comprehensive debug and session logging
  • Process Management: Robust SSH subprocess handling with proper error propagation

§Modules

  • args - Command-line argument parsing
  • config - Configuration loading, watching, and management
  • highlighter - Syntax highlighting engine with regex pattern matching
  • log - Structured logging with multiple levels and targets
  • process - SSH subprocess spawning and I/O handling

§Examples

Basic usage as a library:

use csh::{args, config, process};

fn main() -> csh::Result<std::process::ExitCode> {
    // Parse arguments
    let args = args::main_args();
     
    // Initialize config watcher
    let _watcher = config::config_watcher(None);
     
    // Run SSH process
    process::process_handler(args.ssh_args, args.is_non_interactive)
}

Modules§

args
Command-line argument parsing
config
Configuration management module
highlighter
Syntax highlighting engine
log
Logging module for color-ssh
process
SSH process management and output handling

Macros§

debug_enabled
Check if debug logging is enabled
log_debug
Log a debug message
log_error
Log an error message
log_info
Log an informational message
log_ssh
Log SSH session output
log_warn
Log a warning message

Enums§

Error
Top-level error type encompassing all module-specific errors

Type Aliases§

Result
Result type alias for color-ssh operations