Merge pull request #12509 from poettering/table-fixlets

two trivial fixes to table formatting code
This commit is contained in:
Lennart Poettering 2019-05-08 10:10:55 -04:00 committed by GitHub
commit fd5e11f0bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -94,7 +94,7 @@ static int show_table(Table *table, const char *word) {
assert(table);
assert(word);
if (table_get_rows(table) > 1) {
if (table_get_rows(table) > 1 || OUTPUT_MODE_IS_JSON(arg_output)) {
r = table_set_sort(table, (size_t) 0, (size_t) -1);
if (r < 0)
return log_error_errno(r, "Failed to sort table: %m");

View File

@ -255,7 +255,7 @@ static int show_table(Table *table, const char *word) {
assert(table);
assert(word);
if (table_get_rows(table) > 1) {
if (table_get_rows(table) > 1 || OUTPUT_MODE_IS_JSON(arg_output)) {
r = table_set_sort(table, (size_t) 0, (size_t) -1);
if (r < 0)
return log_error_errno(r, "Failed to sort table: %m");

View File

@ -75,4 +75,4 @@ const void *table_get(Table *t, TableCell *cell);
const void *table_get_at(Table *t, size_t row, size_t column);
int table_to_json(Table *t, JsonVariant **ret);
int table_print_json(Table *t, FILE *f, unsigned json_flags);
int table_print_json(Table *t, FILE *f, JsonFormatFlags json_flags);