mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
repart: adjust "partno" column
In a typical output from systemd-repart, the output is very wide any any wasted space is bad because it pushes the interesting information even further to the right. We usually need at most one or two digits to express the partition numbers, so let's shorten the title of the column to effectively remove two columns in the output. In JSON output, the old field name is retained. This follows the pattern already used for field "drop-in_files". Also right-align the columns with numbers always to the right. I doesn't make sense to align the columns which are only used for JSON output, so stop setting alignment for those.
This commit is contained in:
committed by
Yu Watanabe
parent
1006b7e5ba
commit
cfb6c54324
@@ -3988,17 +3988,17 @@ static int context_dump_partitions(Context *context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
t = table_new("type",
|
||||
t = table_new("type", /* 0 */
|
||||
"label",
|
||||
"uuid",
|
||||
"partno",
|
||||
"part",
|
||||
"file",
|
||||
"node",
|
||||
"offset",
|
||||
"old size",
|
||||
"raw size",
|
||||
"size",
|
||||
"old padding",
|
||||
"old padding", /* 10 */
|
||||
"raw padding",
|
||||
"padding",
|
||||
"activity",
|
||||
@@ -4008,6 +4008,9 @@ static int context_dump_partitions(Context *context) {
|
||||
if (!t)
|
||||
return log_oom();
|
||||
|
||||
/* For compatiblity, use the original longer name for JSON output. */
|
||||
table_set_json_field_name(t, 3, "partno");
|
||||
|
||||
/* Starting in v257, these fields would be automatically formatted with underscores. This would have
|
||||
* been a breaking change, so to avoid that let's hard-code their original names. */
|
||||
table_set_json_field_name(t, 15, "drop-in_files");
|
||||
@@ -4024,13 +4027,13 @@ static int context_dump_partitions(Context *context) {
|
||||
split_path_col);
|
||||
}
|
||||
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 5), 100);
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 3), 100);
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 6), 100);
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 7), 100);
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 8), 100);
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 9), 100);
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 10), 100);
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 11), 100);
|
||||
(void) table_set_align_percent(t, table_get_cell(t, 0, 12), 100);
|
||||
|
||||
LIST_FOREACH(partitions, p, context->partitions) {
|
||||
_cleanup_free_ char *size_change = NULL, *padding_change = NULL, *partname = NULL, *rh = NULL;
|
||||
|
||||
Reference in New Issue
Block a user