mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-25 12:21:14 -03:00
After #9542, the format for `functions -Dv` was changed for copied functions. ```diff -stdin -n/a +[path to copy location] +[path to original definition] [and a few more lines] ``` Some components were (and perhaps are) still expecting the old format, however. After a search, it looks like `funced` and `fish_config` are the only two functions using `functions -D` and `functions -Dv` in this repo (none are using `type -p`). As noted in issue #11614, `funced` currently edits the file which copies the given copied function. Another option was to make `funced` edit the file which originally defined the function. Since the copied function would not have been updated either way, I modified `funced` so it would pretend that the copied function was defined interactively, like it was before. I did not modify `fish_config`, since it was only used for preset prompts in the web config, none of which used `functions --copy`. (Moreover, I believe it would have behaved correctly, since the preset would not have had to define the function, only copy it.) Fixes issue #11614
24 lines
683 B
Fish
24 lines
683 B
Fish
#RUN: %fish %s
|
|
|
|
function my-src
|
|
echo hello
|
|
end
|
|
|
|
echo "functions --copy my-src my-dst" >my-copy-function.fish
|
|
source my-copy-function.fish
|
|
rm my-copy-function.fish # Cleanup
|
|
|
|
functions --details --verbose my-dst
|
|
# CHECK: my-copy-function.fish
|
|
# CHECK: {{.*}}tests/checks/funced.fish
|
|
# CHECK: 3
|
|
# CHECK: scope-shadowing
|
|
|
|
VISUAL=cat EDITOR=cat funced my-dst
|
|
# CHECK: # Defined in {{.*}}/tests/checks/funced.fish @ line 3, copied in my-copy-function.fish @ line 1
|
|
# CHECK: function my-dst
|
|
# CHECK: echo hello
|
|
# CHECK: end
|
|
# CHECK: Editor exited but the function was not modified
|
|
# CHECK: If the editor is still running, check if it waits for completion, maybe a '--wait' option?
|