]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh-pool: Unify spacing of listing function
authorPeter Krempa <pkrempa@redhat.com>
Tue, 12 Nov 2013 16:22:36 +0000 (17:22 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 13 Nov 2013 09:07:32 +0000 (10:07 +0100)
Change the alignment to match the domain listing function.

Before:

$ virsh pool-list
Name                 State      Autostart
-----------------------------------------
boot-scratch         active     no
default              active     no
glusterpool          active     no

$ virsh pool-list --details
Name          State    Autostart  Persistent    Capacity  Allocation  Available
-------------------------------------------------------------------------------
boot-scratch  running  no         yes         117.99 GiB  101.40 GiB  16.60 GiB
default       running  no         yes         117.99 GiB  101.40 GiB  16.60 GiB
glusterpool   running  no         yes          29.40 GiB   44.23 MiB  29.36 GiB

After:

$ virsh pool-list
 Name                 State      Autostart
-------------------------------------------
 boot-scratch         active     no
 default              active     no
 glusterpool          active     no

$ virsh pool-list --details
 Name          State    Autostart  Persistent    Capacity  Allocation  Available
---------------------------------------------------------------------------------
 boot-scratch  running  no         yes         117.99 GiB  101.40 GiB  16.60 GiB
 default       running  no         yes         117.99 GiB  101.40 GiB  16.60 GiB
 glusterpool   running  no         yes          29.40 GiB   44.23 MiB  29.36 GiB

tools/virsh-pool.c

index c771226d5712b416d16a0934194427206a080600..18fe242a3f41f57474a2b8f719a9fac7555c8160 100644 (file)
@@ -1191,14 +1191,14 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     /* Output basic info then return if --details option not selected */
     if (!details) {
         /* Output old style header */
-        vshPrintExtra(ctl, "%-20s %-10s %-10s\n", _("Name"), _("State"),
+        vshPrintExtra(ctl, " %-20s %-10s %-10s\n", _("Name"), _("State"),
                       _("Autostart"));
-        vshPrintExtra(ctl, "-----------------------------------------\n");
+        vshPrintExtra(ctl, "-------------------------------------------\n");
 
         /* Output old style pool info */
         for (i = 0; i < list->npools; i++) {
             const char *name = virStoragePoolGetName(list->pools[i]);
-            vshPrint(ctl, "%-20s %-10s %-10s\n",
+            vshPrint(ctl, " %-20s %-10s %-10s\n",
                  name,
                  poolInfoTexts[i].state,
                  poolInfoTexts[i].autostart);
@@ -1266,7 +1266,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
      * the longest string.
      */
     ret = virAsprintf(&outputStr,
-              "%%-%lus  %%-%lus  %%-%lus  %%-%lus  %%%lus  %%%lus  %%%lus\n",
+              " %%-%lus  %%-%lus  %%-%lus  %%-%lus  %%%lus  %%%lus  %%%lus\n",
               (unsigned long) nameStrLength,
               (unsigned long) stateStrLength,
               (unsigned long) autostartStrLength,
@@ -1285,7 +1285,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     for (i = nameStrLength + stateStrLength + autostartStrLength
                            + persistStrLength + capStrLength
                            + allocStrLength + availStrLength
-                           + 12; i > 0; i--)
+                           + 14; i > 0; i--)
         vshPrintExtra(ctl, "-");
     vshPrintExtra(ctl, "\n");