tabcount

Count tabs in files

Go File Recovery GitHub

Count tab characters in files and directories. Quick diagnostic for tab/space consistency issues before editing.

Features

  • Count tabs in single files or entire directories
  • Report per-file tab counts
  • Quick diagnostic before using notab

Install

go install github.com/hegner123/tabcount@latest

The Problem: Is this file using tabs or spaces?

# Before editing, you need to know if a file has tabs.
# cat -A shows every character  - too verbose.
# You just need a count.

Solution

$ tabcount --cli --dir ./src --ext .go

Output

{"files":[{"path":"src/main.go","tabs":142},{"path":"src/server.go","tabs":98},{"path":"src/config.go","tabs":0}],"total_tabs":240,"files_with_tabs":2,"files_without_tabs":1}

Comparison

MetricValue
Diagnostic fornotab (convert tabs before editing)
ScopeSingle file or directory scan