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".
This commit is contained in:
Tom Tromey
2019-06-04 20:00:40 -06:00
parent 6a831f06e1
commit 14309bb6bf
4 changed files with 18 additions and 3 deletions

View 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> 2019-10-01 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com> Tom Tromey <tom@tromey.com>

View File

@@ -49,6 +49,7 @@
#include "cli/cli-script.h" #include "cli/cli-script.h"
#include "cli/cli-setshow.h" #include "cli/cli-setshow.h"
#include "cli/cli-cmds.h" #include "cli/cli-cmds.h"
#include "cli/cli-style.h"
#include "cli/cli-utils.h" #include "cli/cli-utils.h"
#include "extension.h" #include "extension.h"
@@ -451,10 +452,14 @@ pwd_command (const char *args, int from_tty)
safe_strerror (errno)); safe_strerror (errno));
if (strcmp (cwd.get (), current_directory) != 0) if (strcmp (cwd.get (), current_directory) != 0)
printf_unfiltered (_("Working directory %s\n (canonically %s).\n"), printf_unfiltered (_("Working directory %ps\n (canonically %ps).\n"),
current_directory, cwd.get ()); styled_string (file_name_style.style (),
current_directory),
styled_string (file_name_style.style (), cwd.get ()));
else else
printf_unfiltered (_("Working directory %s.\n"), current_directory); printf_unfiltered (_("Working directory %ps.\n"),
styled_string (file_name_style.style (),
current_directory));
} }
void void

View 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> 2019-10-01 Tom Tromey <tom@tromey.com>
* gdb.base/style.exp: Update tests. * gdb.base/style.exp: Update tests.

View File

@@ -131,4 +131,6 @@ save_vars { env(TERM) } {
gdb_test "file $binfile" \ gdb_test "file $binfile" \
"Reading symbols from [style $quoted file]..." \ "Reading symbols from [style $quoted file]..." \
"filename is styled when loading symbol file" "filename is styled when loading symbol file"
gdb_test "pwd" "Working directory [style .*? file].*"
} }