Skip to content

combine functions behind to/from-c/tsv commands#990

Merged
andrasio merged 1 commit intonushell:masterfrom
drmason13:combine-csv-and-tsv
Nov 19, 2019
Merged

combine functions behind to/from-c/tsv commands#990
andrasio merged 1 commit intonushell:masterfrom
drmason13:combine-csv-and-tsv

Conversation

@drmason13
Copy link
Copy Markdown
Contributor

fixes #969, admittedly without a --delimiter alias

moves from_structured_data.rs to from_delimited_data.rs to better
identify its scope and adds to_delimited_data.rs. Now csv and tsv both
use the same code, tsv passes in a fixed '\t' argument where csv passes
in the value of --separator

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Nov 19, 2019

fn can_convert_table_to_tsv_text_and_from_tsv_text_back_into_table_using_csv_separator() {
let actual = nu!(
cwd: "tests/fixtures/formats",
r"open caco3_plastics.csv | to-tsv | from-csv --separator '\t' | first 1 | get origin | echo $it"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be caco3_plastics.tsv ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes! it should, good spot

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me just force push over this, if that's ok with you?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I think this test is correct. You are opening a csv file and getting a table, converting to tsv and using the expected from-csv with the separator wanted in this case.

This is correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's slightly confusing... but yes, it wouldn't matter what format the file was as long as it reads as a table, then we make tsv text (so we add tabs) and then we parse that as csv separated by tabs...

I think this does the job of demonstrating that tsv and csv --separator '\t' are interoperable :D

fixes #969, admittedly without a --delimiter alias

moves from_structured_data.rs to from_delimited_data.rs to better
identify its scope and adds to_delimited_data.rs. Now csv and tsv both
use the same code, tsv passes in a fixed '\t' argument where csv passes
in the value of --separator
@andrasio andrasio merged commit 388fc24 into nushell:master Nov 19, 2019
bobhy pushed a commit to bobhy/nushell that referenced this pull request Oct 22, 2023
* Updated the oh-my-posh setup guide

* fixed typo
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.

combine csv and tsv functions behind [to/from]-[csv/tsv] commands

2 participants