4 releases (2 breaking)

0.8.0 Nov 15, 2019
0.7.0 Oct 15, 2019
0.6.5 Oct 11, 2019
0.6.4 Sep 26, 2019

#34 in #cat

MIT license

10KB
131 lines

Catalist

Reads the data, not the comments. It's like cat(1), but for lists. Hah.

Catalist is designed to be a small and fast program to only read the content of a list, not the information intended to keep it organised.

Installation

Catalist can be installed through cargo. This will build it from source.

$ cargo install catalist

Usage

Catalist can read from files or from stdin. If no files are given, it will default to reading from stdin.

The contents of example.list:

$ cat example.list
# Metavariables are useful for programming!
Foo
Bar
Baz

# These ones are barely used
Qux Quux
Quuz

Catalist ignores empty lines and comments. Lines containing whitespace are automatically quoted.

$ catalist example.list
Foo
Bar
Baz
"Qux Quux"
Quuz

Quotes

The quote logic can be changed by providing the --quotes <logic> option. The option takes one of auto, always, or never. If the option is omitted, catalist defaults to auto.

$ catalist --quotes always example.list
"Foo"
"Bar"
"Baz"
"Qux Quux"
"Quuz"

Input

Catalist will read from stdin if the file name is a dash (-) or there are no files given.

$ cat example.list | catalist --quotes never
Foo
Bar
Baz
Qux Quux
Quuz

Comments

A comment is a hash (#) either preceeded by whitespace or at the start of a line. Everything else is treated as content.

$ cat comments.list
# This is a comment

Example # comment
This is# not a comment

$ catalist comments.list
Example
"This is# not a comment"

License

This project is licensed under the MIT license.

Dependencies

~3MB
~52K SLoC