Skip to content

Commit

Permalink
Crop long variables names in fmu_info()
Browse files Browse the repository at this point in the history
fixes #672
  • Loading branch information
t-sommer committed Dec 16, 2024
1 parent 561ae94 commit fc3a7bb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions fmpy/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,11 +689,16 @@ def fmu_info(filename: Union[str, IO], causalities: List[str] = ['input', 'outpu
if v.causality not in causalities:
continue

name = v.name

if len(name) > 18:
name = '...' + name[-15:]

start = str(v.start) if v.start is not None else ''

unit = v.declaredType.unit if v.declaredType else v.unit

args = ['' if s is None else str(s) for s in [v.name, v.causality, start, unit, v.description]]
args = ['' if s is None else str(s) for s in [name, v.causality, start, unit, v.description]]

l.append(' {:18} {:10} {:>23} {:8} {}'.format(*args))

Expand Down

0 comments on commit fc3a7bb

Please sign in to comment.