Skip to content

tksh/addi

Repository files navigation

addi

addi -- add indentation to ls output

Overview

addi is a command-line tool that reformats the output of ls -lR by removing total lines and indenting subdirectories recursively. It reads from stdin and writes to stdout, fitting naturally into Unix pipelines.

Installation

go install github.com/tksh/addi@latest

Or build from source:

git clone https://github.com/tksh/addi.git
cd addi
go build -o addi .

Usage

ls -lR | addi
ls -lR | addi -s
ls -lR | addi --simple

Options

Flag Description
-s Simple mode: show only file type character and filename
--simple Alias for -s
-h Print help message
--help Alias for -h

Examples

For side-by-side comparisons of ls output with and without addi, see EXAMPLES.md.

Basic usage:

ls -lR | addi

Simple mode (file type + name only):

ls -lR | addi -s

Input Format

addi requires ls -lR output as input. The -l (long listing) and -R (recursive) flags are essential for the tool to function.

Additional flags are optional but recommended:

Flag Description
-h Human-readable sizes
-A Show hidden files (except . and ..)
-I Ignore files matching PATTERN (e.g., .git)

Output Behavior

  • total lines are removed
  • Empty lines between directory sections are preserved
  • Subdirectories are indented with 8 spaces per nesting level
  • Root directory path is displayed in faint text (dimmed) for readability
  • In simple mode (-s), file metadata is stripped to show only the file type character and filename
  • Set NO_COLOR environment variable to disable ANSI color codes

Environment

  • Linux
  • Go 1.26.5 or later

License

Mozilla Public License Version 2.0

About

add indentation to ls output

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors