Skip to content

Commit

Permalink
extend .infile-list functionality
Browse files Browse the repository at this point in the history
- ignore empty lines
- ignore lines that start with "#"
  • Loading branch information
jqnatividad committed Mar 9, 2024
1 parent 0652dfd commit 20a45c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -259,7 +259,7 @@ Click [here](https://docs.rs/file-format/latest/file_format/#reader-features) fo

The `cat`, `headers`, `sqlp` & `to` commands have extended input support (🗄️). If the input is `-` or empty, the command will try to use stdin as input. If it's not, it will check if its a directory, and if so, add all the files in the directory as input files.

If its a file, it will first check if it has an `.infile-list` extension. If it does, it will load the text file and parse each line as an input file path. This is a much faster and convenient way to process a large number of input files, without having to pass them all as separate command-line arguments. Further, the file paths can be anywhere in the file system, even on separate volumes. If an input file path is not fully qualified, it will be treated as relative to the current working directory.
If its a file, it will first check if it has an `.infile-list` extension. If it does, it will load the text file and parse each line as an input file path. This is a much faster and convenient way to process a large number of input files, without having to pass them all as separate command-line arguments. Further, the file paths can be anywhere in the file system, even on separate volumes. If an input file path is not fully qualified, it will be treated as relative to the current working directory. Empty lines and lines starting with `#` are ignored.

For both directory and `.infile-list` input, snappy compressed files with a `.sz` extension will be automatically decompressed.

Expand Down
1 change: 1 addition & 0 deletions src/util.rs
Expand Up @@ -1499,6 +1499,7 @@ pub fn process_input(
input_file.read_to_string(&mut input_file_contents)?;
input_file_contents
.lines()
.filter(|line| !line.is_empty() && !line.starts_with('#'))
.map(PathBuf::from)
.collect::<Vec<_>>()
} else {
Expand Down

0 comments on commit 20a45c8

Please sign in to comment.