public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Style "pwd" output
@ 2019-10-01 21:25 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2019-10-01 21:25 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=14309bb6bfe31e5ad26035cd41a46bdbaec154b0

commit 14309bb6bfe31e5ad26035cd41a46bdbaec154b0
Author: Tom Tromey <tom@tromey.com>
Date:   Tue Jun 4 20:00:40 2019 -0600

    Style "pwd" output
    
    This changes the "pwd" command to style its output.
    
    gdb/ChangeLog
    2019-10-01  Tom Tromey  <tom@tromey.com>
    
    	* cli/cli-cmds.c (pwd_command): Style output.
    
    gdb/testsuite/ChangeLog
    2019-10-01  Tom Tromey  <tom@tromey.com>
    
    	* gdb.base/style.exp: Test "pwd".

Diff:
---
 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/ChangeLog b/gdb/ChangeLog
index 980aa60..514a8bd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2019-10-01  Tom Tromey  <tom@tromey.com>
+
+	* cli/cli-cmds.c (pwd_command): Style output.
+
 2019-10-01  Pedro Alves  <palves@redhat.com>
 	    Tom Tromey  <tom@tromey.com>
 
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 59c71f6..9f7b052 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/ChangeLog b/gdb/testsuite/ChangeLog
index b9a320c..88cec5d 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
 2019-10-01  Tom Tromey  <tom@tromey.com>
 
+	* gdb.base/style.exp: Test "pwd".
+
+2019-10-01  Tom Tromey  <tom@tromey.com>
+
 	* gdb.base/style.exp: Update tests.
 
 2019-10-01  Andreas Arnez  <arnez@linux.ibm.com>
diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp
index d2c3105b..fb0dfed 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].*"
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-01 21:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-01 21:25 [binutils-gdb] Style "pwd" output Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).