Skip to content

CleanCut/headtail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

headtail

head and tail simultaneously!

Backstory

Not finding an existing utility to head and tail the output, nor a good way to combine existing utilities even with the help of a couple friends of mine, we decided to make one. We ended up doing a "day of learning" session with about 50 other engineers from GitHub and collaboritively came up with a minimum viable solution that worked well!

Now it's a real utility that we keep improving. Go try it out!

Contributing

Contributions are welcome! Here are some good first issues you could look into.

Quick Start

You need to have Rust installed.

# Install latest *release* version of headtail
$ cargo install headtail
# Use it on a file - prints the first 10 and last 10 lines
$ headtail somebigfile.txt

# Pipe stdout to it - prints the first 10 and last 10 lines
$ somecommand | headtail

# Print the first 25 and last 5 lines of a file
$ headtail somebigfile.txt -H 25 -T 5

# Print the default amount of first lines, but only 3 last lines
$ headtail somebigfile.txt -T 3

# Do the default thing...but then keep tailing the file and print
# out anything new that is appended to it.
$ headtail somebigfile.txt -f

See headtail -h for a full list of command-line options.

Development

# Run locally with arguments
$ cargo run -- YOUR_ARGS_GO_HERE

# Enable debug logging
$ RUST_LOG=trace cargo run -- YOUR_ARGS_GO_HERE

# Install local development version of headtail into your ~/.cargo/bin
$ cargo install --path .

Software License

Distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See license/APACHE and license/MIT.