Skip to content

lassejlv/better-cat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Better Cat

A simple cat alternative written in Rust with syntax highlighting and some extra features.

Features

  • Syntax Highlighting: Automatic syntax highlighting for various file types
  • Line Numbers: Optional line numbering with -n flag
  • Clipboard Integration: Copy output directly to clipboard
  • Smart Copy Confirmation: Prompts for large content (>2500 chars) unless forced
  • Multi-file Support: Display multiple files with clear separators
  • Show All Characters: Display non-printable characters with -A flag

Installation

cargo build --release

The binary will be available as bcat in target/release/.

Usage

Basic Usage

bcat file.rs
bcat file1.py file2.js  # Multiple files

With Line Numbers

bcat -n file.rs
bcat --number file.rs

Copy to Clipboard

bcat -c file.rs          # Copy with confirmation for large files
bcat -cf file.rs         # Force copy without confirmation
bcat --copy --force file.rs

Show All Characters

bcat -A file.txt
bcat --show-all file.txt

Combined Options

bcat -nc file.rs         # Line numbers + copy
bcat -nAcf file.rs       # All options combined

Command Line Options

Option Short Description
--number -n Show line numbers
--show-all -A Show all characters (including non-printable)
--copy -c Copy output to clipboard
--force -f Force copy without confirmation for large content
--help -h Show help message

Examples

Display a Rust file with syntax highlighting:

bcat src/main.rs

Copy a configuration file to clipboard with line numbers:

bcat -nc config.toml

View multiple files with all characters visible:

bcat -A file1.txt file2.log

Dependencies

  • clap - Command line argument parsing
  • syntect - Syntax highlighting
  • anyhow - Error handling
  • arboard - Clipboard integration

License

This project is open source and available under the MIT license.

About

A simple cat alternative written in Rust with syntax highlighting and some extra features.

Resources

Stars

Watchers

Forks

Languages