nushell: Shouldn't `split column` and `split chars` be `str` subcommands?
Question
I was thinking that str subcommands are exclusively commands which take and return strings. However, I’ve noticed str index-of is there, which returns a number. So, shouldn’t split column and split chars, which return structures of strings, be str subcommands too? I just want to understand how these commands are batched together.
Additional context and details
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 18 (11 by maintainers)
This is how I would parse the /etc/passwd on my Mac, not sure it’s the same on Linux.
or alternately
detect columnsandfrom ssvare really for parsing space delimited files.I’m not sure exactly how to use
split columnsmyself, other than what the examples show.As an addendum to the original post: I think
split rows, which is the “fundamental” split analogous to JS and Python.split(), is too difficult to discover and should not require the wordrowsat all. I think thecolumnsversion is also pretty bizarre, insofar as one can simply add| rotate --ccwtorows’s output to get the same result.I think we need to have a balance between having a bunch of commands that do similar things and having one command that has dozens of command line parameters. In general we want to have easy to use intuitive composable commands.
My problem with putting
detect columnsfunctionality intofrom ssvis really about the name.from ssvjust doesn’t say to me that we want to take some human readable columnar output and transform it to nushell tables. On the other hand, if I have a csv that is delimited by spaces instead of commas, I think offrom ssv.Having said that, I could see taking the
detect columns“guts” and putting it in asfrom ssv --detect. I still have the same problem with the naming but I’m not really sure what to do about it.Linux has
columns -tandtabulatebut I’m not really sure those names are better. I’m open to other suggestions. Anyone have any good ones?You’re right @dandavison,
parseshould be in the same conversation. Maybe we should haveparse columnsthat does thedetect columns/from ssvwork?