Display version information and exit.
.TP
.BR \-x , " \-\-sort " \fIcolumn\fP
-Sort output lines by \fIcolumn\fP. This option enables \fB\-\-list\fR output.
+Sort output lines by \fIcolumn\fP. This option enables \fB\-\-list\fR output format by default.
+It is possible to use the option \fI\-\-tree\fP to force tree-like output and
+than the tree branches are sorted by the \fIcolumn\fP.
.SH NOTES
For partitions, some information (e.g. queue attributes) is inherited from the
parent device.
fputs(_(" -I, --include <list> show only devices with specified major numbers\n"), out);
fputs(_(" -J, --json use JSON output format\n"), out);
fputs(_(" -l, --list use list format output\n"), out);
+ fputs(_(" -T, --tree use tree format output\n"), out);
fputs(_(" -m, --perms output info about permissions\n"), out);
fputs(_(" -n, --noheadings don't print headings\n"), out);
fputs(_(" -o, --output <list> output columns\n"), out);
int c, status = EXIT_FAILURE;
char *outarg = NULL;
size_t i;
+ int force_tree = 0;
static const struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
{ "pairs", no_argument, NULL, 'P' },
{ "scsi", no_argument, NULL, 'S' },
{ "sort", required_argument, NULL, 'x' },
+ { "tree", no_argument, NULL, 'T' },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 },
};
{ 'O','f' },
{ 'O','m' },
{ 'O','t' },
- { 'P','l','r' },
+ { 'P','T', 'l','r' },
{ 0 }
};
int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
lsblk_init_debug();
while((c = getopt_long(argc, argv,
- "abdDze:fhJlnmo:OpPiI:rstVSx:", longopts, NULL)) != -1) {
+ "abdDze:fhJlnmo:OpPiI:rstVSTx:", longopts, NULL)) != -1) {
err_exclusive_options(c, longopts, excl, excl_st);
add_uniq_column(COL_REV);
add_uniq_column(COL_TRANSPORT);
break;
+ case 'T':
+ force_tree = 1;
+ break;
case 'V':
printf(UTIL_LINUX_VERSION);
return EXIT_SUCCESS;
}
}
+ if (force_tree)
+ lsblk->flags |= LSBLK_TREE;
+
check_sysdevblock();
if (!ncolumns) {