8000 Interactively defined function loses commented first line of body · Issue #5285 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

Interactively defined function loses commented first line of body #5285

@mqudsi

Description

@mqudsi

I added a function via the interactive commandline as follows:

mqudsi@Blitzkrieg /m/d/r/fish> function replace_in
                                   # argv[1] is the regex pattern of files to match, fed to `fd`
                                   # argv[2] is the pattern of text to search for
                                   # argv[3] is the pattern of text it should be replaced with
                                   for f in (fd $argv[1] .)
                                       string replace -a -- $argv[2] $argv[3] < $f | rewrite $f
                                   end
                               end

But saving this function is parsed/saved with the commented first line replaced with a blank line (the line is lost entirely):

mqudsi@Blitzkrieg /m/d/r/fish> type replace_in
replace_in is a function with definition
function replace_in

    # argv[2] is the pattern of text to search for
    # argv[3] is the pattern of text it should be replaced with
    for f in (fd $argv[1] .)
        string replace -a -- $argv[2] $argv[3] <$f | rewrite $f
    end
end

(Same result after funcsave or funced)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0