Style "pwd" output
authorTom Tromey <tom@tromey.com>
Wed, 5 Jun 2019 02:00:40 +0000 (20:00 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 1 Oct 2019 21:12:39 +0000 (15:12 -0600)
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".

gdb/ChangeLog
gdb/cli/cli-cmds.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/style.exp

index 980aa60571fb3be95f9fb011613a2c4f12c4be5e..514a8bd99ac5d5b699dbe661d0203a6a09d98b06 100644 (file)
@@ -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>
 
index 59c71f675619e7e0259a71ea1716977c95ee646f..9f7b052d8e0249cc398f815ab072e3aa41718204 100644 (file)
@@ -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
index b9a320c981151f4dd58793fcb4e907ffcdea5eef..88cec5dfb379cabe68f2b4b791b472bd525a0718 100644 (file)
@@ -1,3 +1,7 @@
+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.
index d2c3105bb9fd8d72547c8f983266adcf124b744b..fb0dfed00617d7be60991162b8c851ac65a35c73 100644 (file)
@@ -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].*"
 }