mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-21 03:21:16 -03:00
rename --metadata to --details
Discussion in issue #3295 resulted in a decisions to rename the functions --metadata flag to --details. This also fixes a bug in the definition of the short flags for the `functions` command. The `-e` flag does not take an argument and therefore should not be defined as `e:`. Notice that the long form, `--erase`, specifies `no_argument`. This discrepency happened to work due to a quirk of how the flag parsing loop was written.
This commit is contained in:
@@ -6,57 +6,57 @@ function f1
|
||||
end
|
||||
|
||||
# ==========
|
||||
# Verify that `functions --metadata` works as expected when given too many args.
|
||||
set x (functions --metadata f1 f2 2>&1)
|
||||
if test "$x" != "functions: Expected exactly one function name for --metadata"
|
||||
echo "Unexpected output for 'functions --metadata f1 f2': $x" >&2
|
||||
# Verify that `functions --details` works as expected when given too many args.
|
||||
set x (functions --details f1 f2 2>&1)
|
||||
if test "$x" != "functions: Expected exactly one function name for --details"
|
||||
echo "Unexpected output for 'functions --details f1 f2': $x" >&2
|
||||
end
|
||||
|
||||
# ==========
|
||||
# Verify that `functions --metadata` works as expected when given the name of a
|
||||
# Verify that `functions --details` works as expected when given the name of a
|
||||
# known function.
|
||||
set x (functions --metadata f1)
|
||||
set x (functions --details f1)
|
||||
if test "$x" != "stdin"
|
||||
echo "Unexpected output for 'functions --metadata f1': $x" >&2
|
||||
echo "Unexpected output for 'functions --details f1': $x" >&2
|
||||
end
|
||||
|
||||
# ==========
|
||||
# Verify that `functions --metadata` works as expected when given the name of an
|
||||
# Verify that `functions --details` works as expected when given the name of an
|
||||
# unknown function.
|
||||
set x (functions -m f2)
|
||||
set x (functions -D f2)
|
||||
if test "$x" != "n/a"
|
||||
echo "Unexpected output for 'functions --metadata f2': $x" >&2
|
||||
echo "Unexpected output for 'functions --details f2': $x" >&2
|
||||
end
|
||||
|
||||
# ==========
|
||||
# Verify that `functions --metadata` works as expected when given the name of a
|
||||
# Verify that `functions --details` works as expected when given the name of a
|
||||
# function that could be autoloaded but isn't currently loaded.
|
||||
set x (functions -m abbr)
|
||||
set x (functions -D abbr)
|
||||
if test (count $x) -ne 1
|
||||
or not string match -q '*/share/functions/abbr.fish' "$x"
|
||||
echo "Unexpected output for 'functions -m abbr': $x" >&2
|
||||
echo "Unexpected output for 'functions -D abbr': $x" >&2
|
||||
end
|
||||
|
||||
# ==========
|
||||
# Verify that `functions --verbose --metadata` works as expected when given the name of a
|
||||
# Verify that `functions --verbose --details` works as expected when given the name of a
|
||||
# function that was autoloaded.
|
||||
set x (functions -v -m abbr)
|
||||
set x (functions -v -D abbr)
|
||||
if test (count $x) -ne 5
|
||||
or not string match -q '*/share/functions/abbr.fish' $x[1]
|
||||
or test $x[2] != autoloaded
|
||||
or test $x[3] != 1
|
||||
or test $x[4] != scope-shadowing
|
||||
or test $x[5] != 'Manage abbreviations'
|
||||
echo "Unexpected output for 'functions -v -m abbr': $x" >&2
|
||||
echo "Unexpected output for 'functions -v -D abbr': $x" >&2
|
||||
end
|
||||
|
||||
# ==========
|
||||
# Verify that `functions --verbose --metadata` properly escapes a function
|
||||
# Verify that `functions --verbose --details` properly escapes a function
|
||||
# with a multiline description.
|
||||
function multiline_descr -d 'line 1\n
|
||||
line 2 & more; way more'
|
||||
end
|
||||
set x (functions -v -m multiline_descr)
|
||||
set x (functions -v -D multiline_descr)
|
||||
if test $x[5] != 'line 1\\\\n\\nline 2 & more; way more'
|
||||
echo "Unexpected output for 'functions -v -m multiline_descr': $x" >&2
|
||||
echo "Unexpected output for 'functions -v -D multiline_descr': $x" >&2
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user