mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 12:23:09 +00:00
Implement 'functions -d' to set function description
This was documented, but didn't actually work. Fixes #5105
This commit is contained in:
parent
7af3adc344
commit
9d1fc1045e
3 changed files with 16 additions and 1 deletions
|
@ -60,6 +60,7 @@ This section is for changes merged to the `major` branch that are not also merge
|
||||||
- `alias` now has a `-s` and `--save` option to save the function generated by the alias using `funcsave` (#4878).
|
- `alias` now has a `-s` and `--save` option to save the function generated by the alias using `funcsave` (#4878).
|
||||||
- Path completions now support expansions, meaning expressions like `python ~/<TAB>` now provides file suggestions just like any other relative or absolute path. (This includes support for other expansions, too.)
|
- Path completions now support expansions, meaning expressions like `python ~/<TAB>` now provides file suggestions just like any other relative or absolute path. (This includes support for other expansions, too.)
|
||||||
- The `string` builtin has new commands `split0` and `join0` for working with NUL-delimited output.
|
- The `string` builtin has new commands `split0` and `join0` for working with NUL-delimited output.
|
||||||
|
- The `-d` option to `functions` to set the description of an existing function now works; before 3.0 it was documented but unimplemented. Note that the long form `--description` continues to work. (#5105)
|
||||||
|
|
||||||
## Other significant changes
|
## Other significant changes
|
||||||
- Command substitution output is now limited to 10 MB by default (#3822).
|
- Command substitution output is now limited to 10 MB by default (#3822).
|
||||||
|
|
|
@ -39,7 +39,7 @@ struct functions_cmd_opts_t {
|
||||||
wchar_t *handlers_type = NULL;
|
wchar_t *handlers_type = NULL;
|
||||||
wchar_t *description = NULL;
|
wchar_t *description = NULL;
|
||||||
};
|
};
|
||||||
static const wchar_t *short_options = L":HDacehnqv";
|
static const wchar_t *short_options = L":HDacd:ehnqv";
|
||||||
static const struct woption long_options[] = {
|
static const struct woption long_options[] = {
|
||||||
{L"erase", no_argument, NULL, 'e'}, {L"description", required_argument, NULL, 'd'},
|
{L"erase", no_argument, NULL, 'e'}, {L"description", required_argument, NULL, 'd'},
|
||||||
{L"names", no_argument, NULL, 'n'}, {L"all", no_argument, NULL, 'a'},
|
{L"names", no_argument, NULL, 'n'}, {L"all", no_argument, NULL, 'a'},
|
||||||
|
|
|
@ -60,3 +60,17 @@ set x (functions -v -D multiline_descr)
|
||||||
if test $x[5] != 'line 1\\\\n\\nline 2 & more; way more'
|
if test $x[5] != 'line 1\\\\n\\nline 2 & more; way more'
|
||||||
echo "Unexpected output for 'functions -v -D multiline_descr': $x" >&2
|
echo "Unexpected output for 'functions -v -D multiline_descr': $x" >&2
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# ==========
|
||||||
|
# Verify function description setting
|
||||||
|
function test_func_desc ; end
|
||||||
|
functions test_func_desc | string match --quiet '*description*'
|
||||||
|
and echo "Unexpected description" >&2
|
||||||
|
|
||||||
|
functions --description description1 test_func_desc
|
||||||
|
functions test_func_desc | string match --quiet '*description1*'
|
||||||
|
or echo "Failed to find description 1" >&2
|
||||||
|
|
||||||
|
functions -d description2 test_func_desc
|
||||||
|
functions test_func_desc | string match --quiet '*description2*'
|
||||||
|
or echo "Failed to find description 2" >&2
|
||||||
|
|
Loading…
Reference in a new issue