Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental named field support in tsv-select #284

Merged
merged 14 commits into from
May 26, 2020

Conversation

jondegenhardt
Copy link
Contributor

@jondegenhardt jondegenhardt commented May 26, 2020

This PR adds experimental named field support to tsv-select. Assume a file with the header fields:

 1    run
 2    elapsed_time
 3    user_time
 4    system_time
 5    max_memory

Commands like the following can be used:

$ tsv-select data.tsv -H -f user_time           # Field  3
$ tsv-select data.tsv -H -f run,user_time       # Fields 1,3
$ tsv-select data.tsv -H -f run-user_time       # Fields 1,2,3
$ tsv-select data.tsv -H -f '*_memory'          # Field  5
$ tsv-select data.tsv -H -f '*_time'            # Fields 2,3,4
$ tsv-select data.tsv -H -f '*_time,*_memory'   # Fields 2,3,4,5
$ tsv-select data.tsv -H -f '*_memory,*_time'   # Fields 5,2,3,4

Field exclusions work also:

$ tsv-select data.tsv -H -e user_time           # Exclude field  3
$ tsv-select data.tsv -H -e '*_time'            # Exclude fields 2,3,4

Numeric field numbers can be used as before:

$ tsv-select data.tsv -H -f 3                   # Field 3

Support for the feature is complete for tsv-select, but it is not documented yet, including in the help message. Documentation, including help documentation, will be done after named fields have been added to the other tools and a release performed.

Another steps towards enhancement request #25

@codecov-commenter
Copy link

Codecov Report

Merging #284 into master will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #284      +/-   ##
==========================================
+ Coverage   99.28%   99.32%   +0.04%     
==========================================
  Files          17       18       +1     
  Lines        5980     6512     +532     
==========================================
+ Hits         5937     6468     +531     
- Misses         43       44       +1     
Impacted Files Coverage Δ
common/src/tsv_utils/common/fieldlist.d 99.87% <ø> (ø)
common/src/tsv_utils/common/utils.d 100.00% <ø> (ø)
tsv-filter/src/tsv_utils/tsv-filter.d 100.00% <ø> (ø)
tsv-join/src/tsv_utils/tsv-join.d 100.00% <ø> (ø)
tsv-sample/src/tsv_utils/tsv-sample.d 99.43% <ø> (ø)
tsv-split/src/tsv_utils/tsv-split.d 98.45% <ø> (ø)
tsv-summarize/src/tsv_utils/tsv-summarize.d 98.26% <ø> (ø)
tsv-uniq/src/tsv_utils/tsv-uniq.d 100.00% <ø> (ø)
tsv-select/src/tsv_utils/tsv-select.d 100.00% <100.00%> (ø)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants