Skip to content

[DRAFT] Adds from-ssv command. - #830

Merged
sophiajt merged 22 commits into
nushell:masterfrom
thomasheartman:pull-req/from-master
Oct 15, 2019
Merged

sophiajt merged 22 commits into
nushell:masterfrom
thomasheartman:pull-req/from-master

Conversation

@thomasheartman

@thomasheartman thomasheartman commented Oct 14, 2019 •

Copy link
Copy Markdown

(Continued from #828)

As discussed in #807, this pull request implements a from-ssv command that takes a whitespace-separated table and turns it into a nushell data structure.

The implementation is based on the from-tsv command.

In addition to the implementation, I have also added some tests and updated the readme.

Any issues, thoughts, whatever, let me know.

Of note

One issue which has not been completely resolved is the --headerless option, which throws away the first row. If this is the intended behavior (it's how it's implemented in from-tsv today), then all is good. If this is not how it should work, this requires a little more work to change the behavior.

Further development

While this works as it is right now, and I'd hope to get this merged as a first version, one possible expansion would be to allow a user-defined number of spaces in an entry, thus not splitting on any space, but only on at least n spaces.

The motivation for this is the oc get events (and likely also kubectl get events) command, which also returns a space-separated table structure, but which has entries with spaces defined. It seems that all OpenShift (Kubernetes?) output tables use at least three spaces between each column.

So, if that sounds like a good idea, I'd like to look into that as a possible further expansion of this command.

@gitpod-io

gitpod-io Bot commented Oct 14, 2019 •

Copy link
Copy Markdown

@thomasheartman
thomasheartman marked this pull request as ready for review October 14, 2019 21:55
@thomasheartman

thomasheartman commented Oct 14, 2019 •

Copy link
Copy Markdown
Author

So this has more commits listed, but I'm assuming you can squash them through an option, or at least that's what I found after a bit of quick googling? Anyway, sorry for the extra back-and-forth on this, but at least this should be good, I hope :)

@thomasheartman

Copy link
Copy Markdown
Author

Actually, I forgot that I put an unwrap in there while figuring things out. That's not nice. Let me go back and edit that. Is there a way to mark a pull request as draft again?

@sophiajt sophiajt changed the title Adds from-ssv command. [DRAFT] Adds from-ssv command. Oct 14, 2019
@sophiajt

Copy link
Copy Markdown
Contributor

No worries, I'll just update the title for now.

Thomas Hartmann added 2 commits October 15, 2019 00:24
A rogue unwrap had been left in the code, but has now been replaced by an option.
@thomasheartman

Copy link
Copy Markdown
Author

Thanks! Third time's the charm, right?

@sophiajt

Copy link
Copy Markdown
Contributor

This looks good to me :)

If you're comfortable with it, I think it's ready to land.

@thomasheartman

thomasheartman commented Oct 15, 2019 •

Copy link
Copy Markdown
Author

Absolutely! Let’s get it in.

Any thoughts on taking it further, by the way? Implementing a way to only split if there are at least a certain number of spaces? I’ll open an issue for it if it’s of interest.

Also, thanks for being so responsive! It’s been a pleasure to work with you.

@sophiajt

Copy link
Copy Markdown
Contributor

I'll go ahead and land.

I like the idea to give it a couple more options for people who want to have a bit more control.

Something else that's a bit related you might look into also is a to-ssv command.

@sophiajt

Copy link
Copy Markdown
Contributor

And you're welcome :)

@sophiajt
sophiajt merged commit bd6d818 into nushell:master Oct 15, 2019
bobhy pushed a commit to bobhy/nushell that referenced this pull request Oct 22, 2023
* Release notes for `0.78`

Please add your new features and breaking changes to the release notes
by opening PRs against the `release-notes-0.78` branch.

* Document optional cell path members

* Add placeholders

* Mention empty list changes

* Mention comparison operator breaking change

* add a note about better `error make` (nushell#849)

* Update 2023-04-04-nushell_0_78.md

* Update 2023-04-04-nushell_0_78.md

* Update 2023-04-04-nushell_0_78.md

* Update 2023-04-04-nushell_0_78.md

* Update 2023-04-04-nushell_0_78.md

* Update 2023-04-04-nushell_0_78.md

* Mention added `math exp`

* Update 2023-04-04-nushell_0_78.md

* Expand alias changes

* add nushell#8366 to the release notes (nushell#848)

* add nushell#8366 to the release note

* make the title more explicit for the reader

* be more explicit about what "pretty format" means

* fix nuon quoting

* Update 2023-04-04-nushell_0_78.md

---------

Co-authored-by: Reilly Wood <[email protected]>
Co-authored-by: Antoine Stevan <[email protected]>
Co-authored-by: JT <[email protected]>
Co-authored-by: Jakub Žádník <[email protected]>
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