add --post option to split / split2 subcommands #152
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Wei,
I wanted seqkit split / split2 subcommands to have an option to feed output to a shell command, just as implemented in GNU coreutils'
split
as--filter
option (https://man7.org/linux/man-pages/man1/split.1.html).What I did are:
WopenPipe
function inxopen
(I haven't created PR yet: https://github.com/ocxtal/xopen/tree/wopenpipe)openWriter
inhelper.go
, which opens pipe withWopenPipe
if postprocessing command is nonempty.writeSeqs
inhelper.go
to useopenWriter
writeSeqs
insplit{2}.go
to pass postprocessing command stringWopen
insplit{2}.go
toopenWriter
--post (-P)
option tosplit{2}.go
However the patch is incomplete in the following points:
WopenPipe
Since I'm not familiar with golang or unix processes, I'd like ask you to give any kind of comment on the patch. I'd also happy if you could take over and complete this work.
Thanks in advance,
Hajime Suzuki