This PR introduces a CommandIo type that provides a centralized implementation of input and output file/stream setup. Individual commands are no longer responsible for detecting I/O errors, configuring decompression, or setting up termcolor's output streams.
It also:
Makes dump a deprecated alias for the command's new name: cat.
Factors out the transcription logic shared by both head and cat.
Adds a CommandInput type that remembers the name of the input stream and what type of compression it detected.
Adds a CommandOutput type that statically dispatches over File/StdOut and supports termcolor.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: #49, #55
This PR introduces a
CommandIo
type that provides a centralized implementation of input and output file/stream setup. Individual commands are no longer responsible for detecting I/O errors, configuring decompression, or setting uptermcolor
's output streams.It also:
dump
a deprecated alias for the command's new name:cat
.head
andcat
.CommandInput
type that remembers the name of the input stream and what type of compression it detected.CommandOutput
type that statically dispatches overFile
/StdOut
and supportstermcolor
.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.