diff mbox

[ovs-dev,04/27] ovn-nbctl: Drop gratuitous indentation for "show" output.

Message ID 20170430232231.15151-5-blp@ovn.org
State Accepted
Headers show

Commit Message

Ben Pfaff April 30, 2017, 11:22 p.m. UTC
"ovn-nbctl show" indented every line of output by at least 4 spaces, which
needlessly wastes horizontal space.  This drops 4 spaces of indent from
each line of output.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 ovn/utilities/ovn-nbctl.c | 26 +++++++++++++-------------
 tests/ovn-nbctl.at        | 16 ++++++++--------
 2 files changed, 21 insertions(+), 21 deletions(-)

Comments

Russell Bryant May 2, 2017, 8:21 p.m. UTC | #1
On Sun, Apr 30, 2017 at 7:22 PM, Ben Pfaff <blp@ovn.org> wrote:
> "ovn-nbctl show" indented every line of output by at least 4 spaces, which
> needlessly wastes horizontal space.  This drops 4 spaces of indent from
> each line of output.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  ovn/utilities/ovn-nbctl.c | 26 +++++++++++++-------------
>  tests/ovn-nbctl.at        | 16 ++++++++--------
>  2 files changed, 21 insertions(+), 21 deletions(-)

I think this was my fault and I can't remember why I did this.  This
looks good to me.  :-)

Acked-by: Russell Bryant <russell@ovn.org>
Andy Zhou May 3, 2017, 2:19 a.m. UTC | #2
On Sun, Apr 30, 2017 at 4:22 PM, Ben Pfaff <blp@ovn.org> wrote:
> "ovn-nbctl show" indented every line of output by at least 4 spaces, which
> needlessly wastes horizontal space.  This drops 4 spaces of indent from
> each line of output.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Andy Zhou <azhou@ovn.org>
Ben Pfaff May 3, 2017, 3:26 p.m. UTC | #3
On Tue, May 02, 2017 at 04:21:57PM -0400, Russell Bryant wrote:
> On Sun, Apr 30, 2017 at 7:22 PM, Ben Pfaff <blp@ovn.org> wrote:
> > "ovn-nbctl show" indented every line of output by at least 4 spaces, which
> > needlessly wastes horizontal space.  This drops 4 spaces of indent from
> > each line of output.
> >
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> > ---
> >  ovn/utilities/ovn-nbctl.c | 26 +++++++++++++-------------
> >  tests/ovn-nbctl.at        | 16 ++++++++--------
> >  2 files changed, 21 insertions(+), 21 deletions(-)
> 
> I think this was my fault and I can't remember why I did this.  This
> looks good to me.  :-)
> 
> Acked-by: Russell Bryant <russell@ovn.org>

Thanks Russell and Andy, I applied this to master.
diff mbox

Patch

diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index e5999a654131..476b03e57c72 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -569,18 +569,18 @@  lb_by_name_or_uuid(struct ctl_context *ctx, const char *id, bool must_exist)
 static void
 print_lr(const struct nbrec_logical_router *lr, struct ds *s)
 {
-    ds_put_format(s, "    router "UUID_FMT" (%s)\n",
+    ds_put_format(s, "router "UUID_FMT" (%s)\n",
                   UUID_ARGS(&lr->header_.uuid), lr->name);
 
     for (size_t i = 0; i < lr->n_ports; i++) {
         const struct nbrec_logical_router_port *lrp = lr->ports[i];
-        ds_put_format(s, "        port %s\n", lrp->name);
+        ds_put_format(s, "    port %s\n", lrp->name);
         if (lrp->mac) {
-            ds_put_cstr(s, "            mac: ");
+            ds_put_cstr(s, "        mac: ");
             ds_put_format(s, "\"%s\"\n", lrp->mac);
         }
         if (lrp->n_networks) {
-            ds_put_cstr(s, "            networks: [");
+            ds_put_cstr(s, "        networks: [");
             for (size_t j = 0; j < lrp->n_networks; j++) {
                 ds_put_format(s, "%s\"%s\"",
                         j == 0 ? "" : ", ",
@@ -592,13 +592,13 @@  print_lr(const struct nbrec_logical_router *lr, struct ds *s)
 
     for (size_t i = 0; i < lr->n_nat; i++) {
         const struct nbrec_nat *nat = lr->nat[i];
-        ds_put_format(s, "        nat "UUID_FMT"\n",
+        ds_put_format(s, "    nat "UUID_FMT"\n",
                   UUID_ARGS(&nat->header_.uuid));
-        ds_put_cstr(s, "            external ip: ");
+        ds_put_cstr(s, "        external ip: ");
         ds_put_format(s, "\"%s\"\n", nat->external_ip);
-        ds_put_cstr(s, "            logical ip: ");
+        ds_put_cstr(s, "        logical ip: ");
         ds_put_format(s, "\"%s\"\n", nat->logical_ip);
-        ds_put_cstr(s, "            type: ");
+        ds_put_cstr(s, "        type: ");
         ds_put_format(s, "\"%s\"\n", nat->type);
     }
 }
@@ -606,21 +606,21 @@  print_lr(const struct nbrec_logical_router *lr, struct ds *s)
 static void
 print_ls(const struct nbrec_logical_switch *ls, struct ds *s)
 {
-    ds_put_format(s, "    switch "UUID_FMT" (%s)\n",
+    ds_put_format(s, "switch "UUID_FMT" (%s)\n",
                   UUID_ARGS(&ls->header_.uuid), ls->name);
 
     for (size_t i = 0; i < ls->n_ports; i++) {
         const struct nbrec_logical_switch_port *lsp = ls->ports[i];
 
-        ds_put_format(s, "        port %s\n", lsp->name);
+        ds_put_format(s, "    port %s\n", lsp->name);
         if (lsp->parent_name) {
-            ds_put_format(s, "            parent: %s\n", lsp->parent_name);
+            ds_put_format(s, "        parent: %s\n", lsp->parent_name);
         }
         if (lsp->n_tag) {
-            ds_put_format(s, "            tag: %"PRIu64"\n", lsp->tag[0]);
+            ds_put_format(s, "        tag: %"PRIu64"\n", lsp->tag[0]);
         }
         if (lsp->n_addresses) {
-            ds_put_cstr(s, "            addresses: [");
+            ds_put_cstr(s, "        addresses: [");
             for (size_t j = 0; j < lsp->n_addresses; j++) {
                 ds_put_format(s, "%s\"%s\"",
                         j == 0 ? "" : ", ",
diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
index 9f0a2779bec1..975d70287983 100644
--- a/tests/ovn-nbctl.at
+++ b/tests/ovn-nbctl.at
@@ -56,14 +56,14 @@  AT_CHECK([ovn-nbctl ls-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
 AT_CHECK([ovn-nbctl show ls0])
 AT_CHECK([ovn-nbctl ls-add ls0])
 AT_CHECK([ovn-nbctl show ls0 | ${PERL} $srcdir/uuidfilt.pl], [0],
-  [    switch <0> (ls0)
+  [switch <0> (ls0)
 ])
 AT_CHECK([ovn-nbctl ls-add ls0], [1], [],
   [ovn-nbctl: ls0: a switch with this name already exists
 ])
 AT_CHECK([ovn-nbctl --may-exist ls-add ls0])
 AT_CHECK([ovn-nbctl show ls0 | ${PERL} $srcdir/uuidfilt.pl], [0],
-  [    switch <0> (ls0)
+  [switch <0> (ls0)
 ])
 AT_CHECK([ovn-nbctl --add-duplicate ls-add ls0])
 AT_CHECK([ovn-nbctl --may-exist --add-duplicate ls-add ls0], [1], [],
@@ -645,14 +645,14 @@  AT_CHECK([ovn-nbctl lr-list | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
 AT_CHECK([ovn-nbctl show lr0])
 AT_CHECK([ovn-nbctl lr-add lr0])
 AT_CHECK([ovn-nbctl show lr0 | ${PERL} $srcdir/uuidfilt.pl], [0],
-  [    router <0> (lr0)
+  [router <0> (lr0)
 ])
 AT_CHECK([ovn-nbctl lr-add lr0], [1], [],
   [ovn-nbctl: lr0: a router with this name already exists
 ])
 AT_CHECK([ovn-nbctl --may-exist lr-add lr0])
 AT_CHECK([ovn-nbctl show lr0 | ${PERL} $srcdir/uuidfilt.pl], [0],
-  [    router <0> (lr0)
+  [router <0> (lr0)
 ])
 AT_CHECK([ovn-nbctl --add-duplicate lr-add lr0])
 AT_CHECK([ovn-nbctl --may-exist --add-duplicate lr-add lr0], [1], [],
@@ -695,10 +695,10 @@  AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03:04 192.168.1.1/24], [1],
 AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24])
 
 AT_CHECK([ovn-nbctl show lr0 | ${PERL} $srcdir/uuidfilt.pl], [0], [dnl
-    router <0> (lr0)
-        port lrp0
-            mac: "00:00:00:01:02:03"
-            networks: [["192.168.1.1/24"]]
+router <0> (lr0)
+    port lrp0
+        mac: "00:00:00:01:02:03"
+        networks: [["192.168.1.1/24"]]
 ])
 
 AT_CHECK([ovn-nbctl lrp-add lr0 lrp0 00:00:00:01:02:03 192.168.1.1/24], [1], [],