chiark / gitweb /
systemctl: better width and alignment of fields
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 27 Sep 2011 09:20:20 +0000 (11:20 +0200)
committerMichal Schmidt <mschmidt@redhat.com>
Tue, 27 Sep 2011 10:10:33 +0000 (12:10 +0200)
commit4deb3b9391167abfc661dcc43b72c16f6da52861
tree5ad46bad9e7cf7f8c2735408af0c22b908af7ba5
parentebed32bfe832071cde95f6adc01b1097ff079c90
systemctl: better width and alignment of fields

Provide nicer output by taking advantage of the available columns.

Expand UNIT and DESCRIPTION if possible. Economize the space:
 - never give UNIT more width than it can use.
 - if there's a shortage of space, give 25 columns to UNIT, even
   if it would result in overflowing the total columns. The field would not
   be useful below width 25.
 - then if possible, assign up to 25 columns to DESCRIPTION.
 - then split any remaining space evenly between UNIT and DESCRIPTION.

Keep the columns aligned even with '--full'.
src/systemctl.c