From 3fc86869b97071305fe3ae7ce21a4d735278e4c2 Mon Sep 17 00:00:00 2001 From: Joaquim Date: Sat, 2 Sep 2023 02:43:30 +0100 Subject: [PATCH] Fix again the info() function. --- src/gmt_main.jl | 4 +++- test/test_common_opts.jl | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gmt_main.jl b/src/gmt_main.jl index 343667313..e9d8fe569 100644 --- a/src/gmt_main.jl +++ b/src/gmt_main.jl @@ -1390,7 +1390,9 @@ function info(D::GDtype; crs::Bool=false, attribs=false, att::StrSymb="") crs && return isa(D, Vector) ? print_crs(D[1]) : print_crs(D) # Report projection info and return (attribs == false) && (_D = isa(D, Vector) ? D[1] : D) - (attribs == false && att == "") && return isempty(_D.attrib) ? show(_D) : show(_D, attrib_table=make_attrtbl(D, false)) + (attribs == false && att == "" && isempty(_D.attrib)) && return show(_D) + (attribs == false && att == "") && (t = make_attrtbl(D, false); + return isa(t, Tuple) ? show(_D, attrib_table=t[1]) : show(_D, attrib_table=t)) # OK, here we are dealing with printing the attribs, or returning a column with the values of one attrib. (attribs == false && att != "") && (attribs = true) diff --git a/test/test_common_opts.jl b/test/test_common_opts.jl index 75e673e79..14fd4f160 100644 --- a/test/test_common_opts.jl +++ b/test/test_common_opts.jl @@ -271,6 +271,7 @@ D[1].attrib = Dict("nome" => "a", "nome2" => "b"); info(D, attribs=true); info(D[1], att="nome"); # This case is bugged. It returns 1×2 Matrix{String}: "b" "a" + info(D) info(rand(1)); GMT.polygonlevels(D, ["a", "b"], [1,2], att="nome"); GMT.polygonlevels(D, ["a", "b"], [1,2], att="nome", nocase=1);