miller
miller copied to clipboard
Can Miller hook a user up with an error message about (accidentally) using named fields with '--nidx' and similar options?
Hi all,
Yes, I'll preface this by saying this is definitely an "operator error" that can be resolved with experience, or a careful review of the documentation.
However, would it not be beneficial to everyone to see an error message when you try to specify obviously non-numeric fields with --nidx
and -T
(and related) options when using verbs like nest
and cut
that have a -f
option?
For example, if you mistakenly use -T
when you meant --tsv
, this doesn't seem to work right:
echo -e "last_first\nLastName, Firstname" \
| mlr -T cut -f last_first
# result:
# (a couple of blank lines)
Of course this does:
echo -e "last_first\nLastName, Firstname" \
| mlr -T cut -f 1
# result:
# last_first
# LastName, Firstname
…and so, obviously, would mlr --tsv cut -f last_first
.
But ideally, the first case would error out, telling the user "Hey, you know you tried to specify a named field when the input format was numerically indexed, right?"
@ernstki thanks, this is a great idea! :)