Show if a var is read-only with set --show

Fixes #8179.
This commit is contained in:
Fabian Homborg 2021-07-28 21:11:43 +02:00
parent 413fd2fc03
commit 3db78232c6
2 changed files with 4 additions and 0 deletions

View file

@ -512,6 +512,9 @@ static void show_scope(const wchar_t *var_name, int scope, io_streams_t &streams
wcstring_list_t vals = var->as_list();
streams.out.append_format(_(L"$%ls: set in %ls scope, %ls,%ls with %d elements\n"), var_name,
scope_name, exportv, pathvarv, vals.size());
if (var->read_only()) {
streams.out.append(_(L"Variable is read-only\n"));
}
for (size_t i = 0; i < vals.size(); i++) {
if (vals.size() > 100) {

View file

@ -664,6 +664,7 @@ env | string match -e __fish_test_universal_exported_var
# so they should only be shown in global scope.
set -S status
#CHECK: $status: set in global scope, unexported, with 1 elements
#CHECK: Variable is read-only
#CHECK: $status[1]: |0|
set -ql history