From: Karel Zak Date: Mon, 3 Feb 2020 15:50:43 +0000 (+0100) Subject: fdisk: add --list-details X-Git-Tag: v2.36-rc1~233 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Futil-linux.git;a=commitdiff_plain;h=99d78b2fefe340219059486b42a5acd141ec2642 fdisk: add --list-details Signed-off-by: Karel Zak --- diff --git a/disk-utils/fdisk.8 b/disk-utils/fdisk.8 index cc172a0a54..d0ac3bd975 100644 --- a/disk-utils/fdisk.8 +++ b/disk-utils/fdisk.8 @@ -83,6 +83,9 @@ If no devices are given, those mentioned in .I /proc/partitions (if that file exists) are used. .TP +\fB\-x\fR, \fB\-\-list-details\fR +Like \fB\-\-list\fR, but provides more details. +.TP .BR \-o , " \-\-output " \fIlist\fP Specify which output columns to print. Use .B \-\-help diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 25e38fc387..1e0877f642 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -833,6 +833,8 @@ static void __attribute__((__noreturn__)) usage(void) fprintf(out, " %s\n", USAGE_COLORS_DEFAULT); fputs(_(" -l, --list display partitions and exit\n"), out); + fputs(_(" -x, --list-details like --list but with more details\n"), out); + fputs(_(" -o, --output output columns\n"), out); fputs(_(" -t, --type recognize specified partition table type only\n"), out); fputs(_(" -u, --units[=] display units: 'cylinders' or 'sectors' (default)\n"), out); @@ -861,6 +863,7 @@ static void __attribute__((__noreturn__)) usage(void) enum { ACT_FDISK = 0, /* default */ ACT_LIST, + ACT_LIST_DETAILS, ACT_SHOWSIZE }; @@ -883,6 +886,7 @@ int main(int argc, char **argv) { "getsz", no_argument, NULL, 's' }, { "help", no_argument, NULL, 'h' }, { "list", no_argument, NULL, 'l' }, + { "list-details", no_argument, NULL, 'x' }, { "sector-size", required_argument, NULL, 'b' }, { "type", required_argument, NULL, 't' }, { "units", optional_argument, NULL, 'u' }, @@ -909,7 +913,7 @@ int main(int argc, char **argv) fdisk_set_ask(cxt, ask_callback, NULL); - while ((c = getopt_long(argc, argv, "b:Bc::C:hH:lL::o:sS:t:u::vVw:W:", + while ((c = getopt_long(argc, argv, "b:Bc::C:hH:lL::o:sS:t:u::vVw:W:x", longopts, NULL)) != -1) { switch (c) { case 'b': @@ -963,6 +967,9 @@ int main(int argc, char **argv) case 'l': act = ACT_LIST; break; + case 'x': + act = ACT_LIST_DETAILS; + break; case 'L': colormode = UL_COLORMODE_AUTO; if (optarg) @@ -1026,7 +1033,12 @@ int main(int argc, char **argv) switch (act) { case ACT_LIST: + case ACT_LIST_DETAILS: fdisk_enable_listonly(cxt, 1); + + if (act == ACT_LIST_DETAILS) + fdisk_enable_details(cxt, 1); + init_fields(cxt, outarg, NULL); if (argc > optind) {