pdeffebach / ClipData.jl

Move data to and from the clipboard in Julia
https://pdeffebach.github.io/ClipData.jl/stable/
MIT License
82 stars 6 forks source link

Add default print to stdout for mwetable/mwearray #30

Closed svilupp closed 7 months ago

svilupp commented 1 year ago

Fixes https://github.com/pdeffebach/ClipData.jl/issues/29

Changes:

FYI. I didn't add the default IO for the "reading" functionality mwetable(), because that seemed superfluous (it then passes everything to mwetable(t) anyway).

Tests pass. PR Should be ready for review.

pdeffebach commented 7 months ago

@svilupp I'm sorry for missing this helpful PR.

I think this is a great addition. I will give it more attention soon.

pdeffebach commented 7 months ago

Thanks! I added some methods for when there is no tabular input.

Proof things work for tables

julia> t = (a = [1, 2], b = [3, 4]);

julia> mwetable(t)
df = """
a,b
1,3
2,4
""" |> IOBuffer |> CSV.File
julia> io = IOBuffer();

julia> mwetable(io, t);

julia> println(String(take!(io)))
df = """
a,b
1,3
2,4
""" |> IOBuffer |> CSV.File

julia> cliptable(t);

julia> mwetable()
df = """
a,b
1,3
2,4
""" |> IOBuffer |> CSV.File
julia> io = IOBuffer();

julia> mwetable(io);

julia> println(String(take!(io)))
df = """
a,b
1,3
2,4
""" |> IOBuffer |> CSV.File

tests look good! We should merge.

pdeffebach commented 7 months ago

@alecloudenback Good to merge?

We will do a release after this (don't make a release yet)

alecloudenback commented 7 months ago

I am not real familiar off hand with IO and the mwe usage in the tests. I think with a couple hours I could digest that but wouldn’t want to commit to that in the next 1.5 weeks. Don’t let me hold things up if you think it’s good.