[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 1/3] virsh: Reorder some options



According to comments in parsing functions, optional options should be
specified *after* required ones.  It makes sense and help output looks
cleaner.  The only exceptions are options with type == VSH_OT_ARGV.

Signed-off-by: Martin Kletzander <mkletzan redhat com>
---
 tools/virsh-domain.c | 76 ++++++++++++++++++++++++++--------------------------
 tools/virsh-pool.c   |  8 +++---
 tools/virsh-volume.c |  8 +++---
 3 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 8e743f1..541363d 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -3222,11 +3222,6 @@ static const vshCmdOptDef opts_dom_pm_suspend[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("domain name, id or uuid")
     },
-    {.name = "duration",
-     .type = VSH_OT_INT,
-     .flags = VSH_OFLAG_REQ_OPT,
-     .help = N_("duration in seconds")
-    },
     {.name = "target",
      .type = VSH_OT_DATA,
      .flags = VSH_OFLAG_REQ,
@@ -3234,6 +3229,11 @@ static const vshCmdOptDef opts_dom_pm_suspend[] = {
                 "disk(Suspend-to-Disk), "
                 "hybrid(Hybrid-Suspend)")
     },
+    {.name = "duration",
+     .type = VSH_OT_INT,
+     .flags = VSH_OFLAG_REQ_OPT,
+     .help = N_("duration in seconds")
+    },
     {.name = NULL}
 };

@@ -3940,10 +3940,6 @@ static const vshCmdInfo info_save[] = {
 };

 static const vshCmdOptDef opts_save[] = {
-    {.name = "bypass-cache",
-     .type = VSH_OT_BOOL,
-     .help = N_("avoid file system cache when saving")
-    },
     {.name = "domain",
      .type = VSH_OT_DATA,
      .flags = VSH_OFLAG_REQ,
@@ -3954,6 +3950,10 @@ static const vshCmdOptDef opts_save[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("where to save the data")
     },
+    {.name = "bypass-cache",
+     .type = VSH_OT_BOOL,
+     .help = N_("avoid file system cache when saving")
+    },
     {.name = "xml",
      .type = VSH_OT_STRING,
      .help = N_("filename containing updated XML for the target")
@@ -4408,15 +4408,15 @@ static const vshCmdInfo info_managedsave[] = {
 };

 static const vshCmdOptDef opts_managedsave[] = {
-    {.name = "bypass-cache",
-     .type = VSH_OT_BOOL,
-     .help = N_("avoid file system cache when saving")
-    },
     {.name = "domain",
      .type = VSH_OT_DATA,
      .flags = VSH_OFLAG_REQ,
      .help = N_("domain name, id or uuid")
     },
+    {.name = "bypass-cache",
+     .type = VSH_OT_BOOL,
+     .help = N_("avoid file system cache when saving")
+    },
     {.name = "running",
      .type = VSH_OT_BOOL,
      .help = N_("set domain to be running on next start")
@@ -4918,6 +4918,16 @@ static const vshCmdInfo info_dump[] = {
 };

 static const vshCmdOptDef opts_dump[] = {
+    {.name = "domain",
+     .type = VSH_OT_DATA,
+     .flags = VSH_OFLAG_REQ,
+     .help = N_("domain name, id or uuid")
+    },
+    {.name = "file",
+     .type = VSH_OT_DATA,
+     .flags = VSH_OFLAG_REQ,
+     .help = N_("where to dump the core")
+    },
     {.name = "live",
      .type = VSH_OT_BOOL,
      .help = N_("perform a live core dump if supported")
@@ -4934,16 +4944,6 @@ static const vshCmdOptDef opts_dump[] = {
      .type = VSH_OT_BOOL,
      .help = N_("reset the domain after core dump")
     },
-    {.name = "domain",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("domain name, id or uuid")
-    },
-    {.name = "file",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("where to dump the core")
-    },
     {.name = "verbose",
      .type = VSH_OT_BOOL,
      .help = N_("display the progress of dump")
@@ -7452,6 +7452,11 @@ static const vshCmdOptDef opts_metadata[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("domain name, id or uuid")
     },
+    {.name = "uri",
+     .type = VSH_OT_DATA,
+     .flags = VSH_OFLAG_REQ,
+     .help = N_("URI of the namespace")
+    },
     {.name = "live",
      .type = VSH_OT_BOOL,
      .help = N_("modify/get running state")
@@ -7468,11 +7473,6 @@ static const vshCmdOptDef opts_metadata[] = {
      .type = VSH_OT_BOOL,
      .help = N_("use an editor to change the metadata")
     },
-    {.name = "uri",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("URI of the namespace")
-    },
     {.name = "key",
      .type = VSH_OT_DATA,
      .help = N_("key to be used as a namespace identifier"),
@@ -9269,6 +9269,16 @@ static const vshCmdInfo info_migrate[] = {
 };

 static const vshCmdOptDef opts_migrate[] = {
+    {.name = "domain",
+     .type = VSH_OT_DATA,
+     .flags = VSH_OFLAG_REQ,
+     .help = N_("domain name, id or uuid")
+    },
+    {.name = "desturi",
+     .type = VSH_OT_DATA,
+     .flags = VSH_OFLAG_REQ,
+     .help = N_("connection URI of the destination host as seen from the client(normal migration) or source(p2p migration)")
+    },
     {.name = "live",
      .type = VSH_OT_BOOL,
      .help = N_("live migration")
@@ -9341,16 +9351,6 @@ static const vshCmdOptDef opts_migrate[] = {
      .type = VSH_OT_BOOL,
      .help = N_("abort on soft errors during migration")
     },
-    {.name = "domain",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("domain name, id or uuid")
-    },
-    {.name = "desturi",
-     .type = VSH_OT_DATA,
-     .flags = VSH_OFLAG_REQ,
-     .help = N_("connection URI of the destination host as seen from the client(normal migration) or source(p2p migration)")
-    },
     {.name = "migrateuri",
      .type = VSH_OT_DATA,
      .help = N_("migration URI, usually can be omitted")
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 0b8dba5..31f7ec3 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -190,15 +190,15 @@ static const vshCmdOptDef opts_pool_X_as[] = {
      .flags = VSH_OFLAG_REQ,
      .help = N_("name of the pool")
     },
-    {.name = "print-xml",
-     .type = VSH_OT_BOOL,
-     .help = N_("print XML document, but don't define/create")
-    },
     {.name = "type",
      .type = VSH_OT_DATA,
      .flags = VSH_OFLAG_REQ,
      .help = N_("type of the pool")
     },
+    {.name = "print-xml",
+     .type = VSH_OT_BOOL,
+     .help = N_("print XML document, but don't define/create")
+    },
     {.name = "source-host",
      .type = VSH_OT_DATA,
      .help = N_("source-host for underlying storage")
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 4f810f8..66d71aa 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -1621,15 +1621,15 @@ static const vshCmdInfo info_vol_pool[] = {
 };

 static const vshCmdOptDef opts_vol_pool[] = {
-    {.name = "uuid",
-     .type = VSH_OT_BOOL,
-     .help = N_("return the pool uuid rather than pool name")
-    },
     {.name = "vol",
      .type = VSH_OT_DATA,
      .flags = VSH_OFLAG_REQ,
      .help = N_("volume key or path")
     },
+    {.name = "uuid",
+     .type = VSH_OT_BOOL,
+     .help = N_("return the pool uuid rather than pool name")
+    },
     {.name = NULL}
 };

-- 
2.1.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]