summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r--misc-utils/lsblk.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 454f067c8..3e9b96a4d 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -2054,6 +2054,15 @@ int main(int argc, char *argv[])
if (lsblk->dedup_hidden && lsblk->dedup_id == id)
fl |= SCOLS_FL_HIDDEN;
+ if (force_tree
+ && lsblk->flags & LSBLK_JSON
+ && has_tree_col == 0
+ && i + 1 == ncolumns)
+ /* The "--tree --json" specified, but no column with
+ * SCOLS_FL_TREE yet; force it for the last column
+ */
+ fl |= SCOLS_FL_TREE;
+
cl = scols_table_new_column(lsblk->table, ci->name, ci->whint, fl);
if (!cl) {
warn(_("failed to allocate output column"));