Skip to content

Commit

Permalink
Fix again the info() function.
Browse files Browse the repository at this point in the history
  • Loading branch information
joa-quim committed Sep 2, 2023
1 parent 7484c5a commit 3fc8686
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/gmt_main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions test/test_common_opts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3fc8686

Please sign in to comment.