type: Print *only* the path if given --path or --force-path

This is what happens when you check your tests in the wrong tab,
folks.

Fixes #7345.
This commit is contained in:
Fabian Homborg 2020-09-23 17:23:11 +02:00
parent 533957fc2e
commit 1188a12dfd
2 changed files with 7 additions and 3 deletions

View File

@ -187,7 +187,11 @@ maybe_t<int> builtin_type(parser_t &parser, io_streams_t &streams, wchar_t **arg
++found;
res = true;
if (!opts.query && !opts.type) {
streams.out.append_format(L"%ls is %ls\n", name, path.c_str());
if (opts.path || opts.force_path) {
streams.out.append_format(L"%ls\n", path.c_str());
} else {
streams.out.append_format(L"%ls is %ls\n", name, path.c_str());
}
} else if (opts.type) {
streams.out.append(_(L"file\n"));
break;

View File

@ -42,9 +42,9 @@ type -t realpath foobar
# CHECKERR: type: Could not find {{.}}foobar{{.}}
type -P test
# CHECK: test is {{.*}}/test
# CHECK: {{/.*}}test
type -P ls
# CHECK: ls is {{.*}}/ls
# CHECK: {{/.*}}ls
type
echo $status