]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: add --list-details
authorKarel Zak <kzak@redhat.com>
Mon, 3 Feb 2020 15:50:43 +0000 (16:50 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 5 Feb 2020 13:31:00 +0000 (14:31 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fdisk.8
disk-utils/fdisk.c

index cc172a0a548cbde3007c92c74a81ae0ebfaaff36..d0ac3bd975b043a61fadd8e945ae6b4742f5fcf2 100644 (file)
@@ -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
index 25e38fc387e69166ea3c92ad17a6865b6772b656..1e0877f642b937a33de54b945eaf2399ae3db587 100644 (file)
@@ -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 <list>           output columns\n"), out);
        fputs(_(" -t, --type <type>             recognize specified partition table type only\n"), out);
        fputs(_(" -u, --units[=<unit>]          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) {