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

Issues with header based column selection #26

Closed
learnbyexample opened this issue Jul 15, 2021 · 3 comments
Closed

Issues with header based column selection #26

learnbyexample opened this issue Jul 15, 2021 · 3 comments

Comments

@learnbyexample
Copy link

  1. Giving a filename isn't working. Passing stdin works.
$ printf 'a,b,c\n1,2,3\n' > test.csv

# hangs
$ hck -d, -F "a" test.csv
^C

# stdin works
$ printf 'a,b,c\n1,2,3\n' | hck -d, -F "a"
a
1
  1. If -F isn't the last option when giving filename, it works, but the header gets printed twice.
$ hck -F "a" -F "b" -d, test.csv
a	b
a	b
1	2

# stdin works as expected again
$ printf 'a,b,c\n1,2,3\n' | hck -F "a" -F "b" -d,
a	b
1	2
  1. Last field header isn't being recognized. Works if input is single line without newline.
$ printf 'a,b,c\n1,2,3\n' | hck -d, -F "c"
[2021-07-15T10:39:57Z ERROR hck] No headers matched

$ printf 'a,b,c' | hck -d, -F "c"
c
  1. There's no error if there are unmatched headers, but at least one header matched. If this is preferred as the default behavior, adding an option to get error would be useful.
$ printf 'a,b,c\n1,2,3\n' | hck -d, -F "a" -F "xyz"
a
1
@sstadick
Copy link
Owner

Fixes incoming for all of the above! #27

Thank you for the awesome bug report 👍

@sstadick
Copy link
Owner

Okay, the v0.5.3 release should have all the fixes. v0.5.2 would raise an error if you excluded a header and it couldn't find that header, which I classified as a bug and fixed with v0.5.3.

@learnbyexample
Copy link
Author

Thanks for the quick fix :)

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

No branches or pull requests

2 participants