ColorEchoForShell icon indicating copy to clipboard operation
ColorEchoForShell copied to clipboard

feat: add tcsh support

Open moormaster opened this issue 2 months ago • 5 comments

User description

See Issue #2


PR Type

Enhancement


Description

  • Add tcsh shell support with alias-based color functions

  • Refactor generator to support one-line function declarations

  • Update existing shell outputs to use condensed format

  • Fix character escaping for cross-shell compatibility


Diagram Walkthrough

flowchart LR
  A["Generator Script"] --> B["Shell Variables"]
  B --> C["tcsh Aliases"]
  B --> D["Other Shell Functions"]
  C --> E["ColorEcho.tcsh"]
  D --> F["Updated Shell Files"]
  G["Color Table"] --> A

File Walkthrough

Relevant files
Enhancement
generator.sh
Add tcsh support and refactor generator                                   

generator.sh

  • Add tcsh to supported shells list
  • Refactor shell-specific variables for one-line declarations
  • Add tcsh-specific configuration using aliases instead of functions
  • Simplify color table reading logic
+69/-34 
ColorEcho.tcsh
New tcsh color echo implementation                                             

dist/ColorEcho.tcsh

  • New tcsh shell support file with 1270+ color alias definitions
  • Uses alias instead of function declarations
  • Implements tcsh-specific parameter syntax with \!*
  • Includes Rainbow and Reset functionality with tcsh-compatible syntax
+1270/-0
Formatting
ColorEcho.bash
Refactor to one-line declarations                                               

dist/ColorEcho.bash

  • Convert multi-line if-else statements to one-line format
  • Update character class escaping in tr command
+2/-6     
ColorEcho.ksh
Refactor to one-line declarations                                               

dist/ColorEcho.ksh

  • Convert multi-line if-else statements to one-line format
  • Update character class escaping in tr command
+2/-6     
ColorEcho.sh
Refactor to one-line declarations                                               

dist/ColorEcho.sh

  • Convert multi-line if-else statements to one-line format
  • Update character class escaping in tr command
+2/-6     
ColorEcho.zsh
Refactor to one-line declarations                                               

dist/ColorEcho.zsh

  • Convert multi-line if-else statements to one-line format
  • Update character class escaping in tr command
+2/-6     
ColorEcho.fish
Refactor to one-line declarations                                               

dist/ColorEcho.fish

  • Convert multi-line if-else statements to one-line format
  • Update character class escaping in tr command
+2/-6     
Tests
tcsh
Add tcsh testing script                                                                   

test-scripts/tcsh

  • New test script for tcsh shell validation
  • Sources ColorEcho.tcsh and tests all alias functions
  • Uses tcsh-specific syntax for testing
+13/-0   

Summary by CodeRabbit

  • New Features
    • Added tcsh support and unified per-shell handling across sh, bash, zsh, ksh, fish, tcsh.
  • Refactor
    • Reworked per-shell templates and standardized inline generation for color, rainbow, and reset outputs; adjusted temporary/redirection semantics.
  • Bug Fixes
    • Replaced fragile extraction with a robust loop for color table processing.
  • Tests
    • Added a tcsh test harness and appended final colored-output checks in bash, fish, ksh, sh, and zsh test scripts.
  • Chores
    • Updated build/dist flow for the expanded shell set.

moormaster avatar Oct 01 '25 22:10 moormaster