[PATCH 1/2] tools: Reformat --help output of virsh and virt-admin

Michal Privoznik posted 2 patches 1 year ago
[PATCH 1/2] tools: Reformat --help output of virsh and virt-admin
Posted by Michal Privoznik 1 year ago
The --help output of virsh and virt-admin shows supported options
and commands and as such contains new lines. Both these strings
are marked for translation btw. But the way they are formatted
now ('\n' being at the start of new line instead at the end of
the previous) makes it hard to create a syntax-check rule for
'translation message on one line' (next commit).

Reformat both strings a bit (no user visible change though).

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 tools/virsh.c      | 6 ++++--
 tools/virt-admin.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index d9922a35fc..7b71131db3 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -436,8 +436,10 @@ virshUsage(void)
     const vshCmdGrp *grp;
     const vshCmdDef *cmd;
 
-    fprintf(stdout, _("\n%1$s [options]... [<command_string>]"
-                      "\n%2$s [options]... <command> [args...]\n\n"
+    fprintf(stdout, _("\n"
+                      "%1$s [options]... [<command_string>]\n"
+                      "%2$s [options]... <command> [args...]\n"
+                      "\n"
                       "  options:\n"
                       "    -c | --connect=URI      hypervisor connection URI\n"
                       "    -d | --debug=NUM        debug level [0-4]\n"
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index 15a639f1ea..1e22a3c8a9 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -1242,8 +1242,10 @@ vshAdmUsage(void)
     const vshCmdGrp *grp;
     const vshCmdDef *cmd;
 
-    fprintf(stdout, _("\n%1$s [options]... [<command_string>]"
-                      "\n%2$s [options]... <command> [args...]\n\n"
+    fprintf(stdout, _("\n"
+                      "%1$s [options]... [<command_string>]\n"
+                      "%2$s [options]... <command> [args...]\n"
+                      "\n"
                       "  options:\n"
                       "    -c | --connect=URI      daemon admin connection URI\n"
                       "    -d | --debug=NUM        debug level [0-4]\n"
-- 
2.41.0
Re: [PATCH 1/2] tools: Reformat --help output of virsh and virt-admin
Posted by Peter Krempa 1 year ago
On Mon, Sep 04, 2023 at 10:31:47 +0200, Michal Privoznik wrote:
> The --help output of virsh and virt-admin shows supported options
> and commands and as such contains new lines. Both these strings
> are marked for translation btw. But the way they are formatted
> now ('\n' being at the start of new line instead at the end of
> the previous) makes it hard to create a syntax-check rule for
> 'translation message on one line' (next commit).
> 
> Reformat both strings a bit (no user visible change though).

It also makes sense because the formatting will make it look the way how
it is actually formatted later.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>