Skip to content

Commit db9348c

Browse files
committed
Hint to inspection functions when only parts of a system is shown
1 parent b02abba commit db9348c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/systems/abstractsystem.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1884,7 +1884,7 @@ function n_extra_equations(sys::AbstractSystem)
18841884
nextras = n_outer_stream_variables + length(ceqs)
18851885
end
18861886

1887-
function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = true)
1887+
function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; hint = true, bold = true)
18881888
limit = get(io, :limit, false) # if output should be limited,
18891889
rows = first(displaysize(io)) ÷ 5 # then allocate ≈1/5 of display height to each list
18901890

@@ -1898,6 +1898,7 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = t
18981898
nsubs = length(subs)
18991899
nrows = min(nsubs, limit ? rows : nsubs)
19001900
nrows > 0 && printstyled(io, "\nSubsystems ($(nsubs)):"; bold)
1901+
nrows > 0 && hint && print(io, " see ModelingToolkit.get_systems(sys)")
19011902
for i in 1:nrows
19021903
sub = subs[i]
19031904
name = String(nameof(sub))
@@ -1912,7 +1913,7 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = t
19121913
end
19131914
end
19141915
limited = nrows < nsubs
1915-
limited && print(io, "\n") # too many variables to print
1916+
limited && print(io, "\n") # too many to print
19161917

19171918
# Print equations
19181919
eqs = equations(sys)
@@ -1922,6 +1923,7 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = t
19221923
next = n_extra_equations(sys)
19231924
ntot = neqs + nobs + next
19241925
ntot > 0 && printstyled(io, "\nEquations ($ntot):"; bold)
1926+
ntot > 0 && hint && print(io, " see equations(sys)")
19251927
neqs > 0 && print(io, "\n $neqs solvable")
19261928
nobs > 0 && print(io, "\n $nobs observed")
19271929
next > 0 && print(io, "\n $next extra")
@@ -1935,6 +1937,7 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = t
19351937
nvars == 0 && continue # skip
19361938
header = titlecase(String(nameof(varfunc))) # e.g. "Unknowns"
19371939
printstyled(io, "\n$header ($nvars):"; bold)
1940+
hint && print(io, " see $(nameof(varfunc))(sys)")
19381941
nrows = min(nvars, limit ? rows : nvars)
19391942
defs = has_defaults(sys) ? defaults(sys) : nothing
19401943
for i in 1:nrows
@@ -1957,7 +1960,7 @@ function Base.show(io::IO, mime::MIME"text/plain", sys::AbstractSystem; bold = t
19571960
end
19581961
end
19591962
limited = nrows < nvars
1960-
limited && print(io, "\n") # too many variables to print
1963+
limited && printstyled(io, "\n") # too many variables to print
19611964
end
19621965

19631966
return nothing

0 commit comments

Comments
 (0)