Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 5/8] Style "pwd" output
Date: Fri, 27 Sep 2019 21:25:00 -0000	[thread overview]
Message-ID: <20190927212520.20073-6-tom@tromey.com> (raw)
In-Reply-To: <20190927212520.20073-1-tom@tromey.com>

This changes the "pwd" command to style its output.

gdb/ChangeLog
2019-09-27  Tom Tromey  <tom@tromey.com>

	* cli/cli-cmds.c (pwd_command): Style output.

gdb/testsuite/ChangeLog
2019-09-27  Tom Tromey  <tom@tromey.com>

	* gdb.base/style.exp: Test "pwd".
---
 gdb/ChangeLog                    |  4 ++++
 gdb/cli/cli-cmds.c               | 11 ++++++++---
 gdb/testsuite/ChangeLog          |  4 ++++
 gdb/testsuite/gdb.base/style.exp |  2 ++
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 59c71f67561..9f7b052d8e0 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -49,6 +49,7 @@
 #include "cli/cli-script.h"
 #include "cli/cli-setshow.h"
 #include "cli/cli-cmds.h"
+#include "cli/cli-style.h"
 #include "cli/cli-utils.h"
 
 #include "extension.h"
@@ -451,10 +452,14 @@ pwd_command (const char *args, int from_tty)
            safe_strerror (errno));
 
   if (strcmp (cwd.get (), current_directory) != 0)
-    printf_unfiltered (_("Working directory %s\n (canonically %s).\n"),
-		       current_directory, cwd.get ());
+    printf_unfiltered (_("Working directory %ps\n (canonically %ps).\n"),
+		       styled_string (file_name_style.style (),
+				      current_directory),
+		       styled_string (file_name_style.style (), cwd.get ()));
   else
-    printf_unfiltered (_("Working directory %s.\n"), current_directory);
+    printf_unfiltered (_("Working directory %ps.\n"),
+		       styled_string (file_name_style.style (),
+				      current_directory));
 }
 
 void
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index d2c3105bb9f..fb0dfed0061 100644
--- a/gdb/testsuite/gdb.base/style.exp
+++ b/gdb/testsuite/gdb.base/style.exp
@@ -131,4 +131,6 @@ save_vars { env(TERM) } {
     gdb_test "file $binfile" \
 	"Reading symbols from [style $quoted file]..." \
 	"filename is styled when loading symbol file"
+
+    gdb_test "pwd" "Working directory [style .*? file].*"
 }
-- 
2.17.2


  parent reply	other threads:[~2019-09-27 21:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-27 21:25 [PATCH 0/8] More gdb styling improvements Tom Tromey
2019-09-27 21:25 ` [PATCH 7/8] Use styled_string in more places Tom Tromey
2019-09-27 21:25 ` [PATCH 2/8] Don't create empty literal pieces Tom Tromey
2019-09-27 21:25 ` [PATCH 3/8] Introduce gdb-specific %p format suffixes Tom Tromey
2019-09-30 14:06   ` Pedro Alves
2021-08-18  9:02   ` Andreas Schwab
2021-08-27 20:17     ` Tom Tromey
2019-09-27 21:25 ` Tom Tromey [this message]
2019-09-27 21:25 ` [PATCH 4/8] Use new %p format suffixes in gdb Tom Tromey
2019-09-30 14:05   ` Pedro Alves
2019-09-27 21:25 ` [PATCH 8/8] Use styled_string for "show logging filename" Tom Tromey
2019-09-27 21:25 ` [PATCH 1/8] Remove the ui_out_style_kind enum Tom Tromey
2019-09-27 21:25 ` [PATCH 6/8] Introduce metadata style Tom Tromey
2019-09-30 14:07   ` Pedro Alves
2019-09-30 14:09 ` [PATCH 0/8] More gdb styling improvements Pedro Alves
2019-10-01 21:11   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190927212520.20073-6-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox