xwc 0.2.0

A small wc-style command line tool
Documentation

xwc

xwc is a small wc-style command line tool for counting lines, bytes, and optionally words.

By default it prints line and byte counts with headings:

$ printf 'one two\nthree\n' | xwc
lines  bytes
2      14

Usage

$ xwc [OPTIONS] [FILE]...

When no files are provided, xwc reads from standard input. Use - as a file argument to read from standard input alongside file paths.

Options:

  • -l, --lines: print only the newline count.
  • -c, --bytes: print only the byte count.
  • -w, --words: print only the word count.
  • -W, --include-words: include the word count in the default output columns (slower).
  • -h, --human-readable: print byte counts with human-readable units and use the size heading.
  • --help: print help.

Examples:

$ xwc Cargo.toml src/main.rs
lines  bytes  file
8      174    Cargo.toml
420    10324  src/main.rs
428    10498  total

$ xwc --include-words Cargo.toml
lines  words  bytes  file
8      24     174    Cargo.toml

$ xwc -hc Cargo.toml
174B  Cargo.toml

Development

Run the binary through Cargo:

$ cargo run -- [OPTIONS] [FILE]...

Or use the Just proxy recipe:

$ just xwc --include-words Cargo.toml

Common development recipes:

$ just fmt
$ just check
$ just test-no-coverage