Skip to content

In a function, heredoc instructions after a block of commands grouped with curly braces break outline view #245

@jerdoe

Description

@jerdoe

When using the following examples, outline view does not show all the functions.
This seems to occur when heredoc instructions in a function, follow a block of commands that was grouped with curly braces.

#!/bin/bash

myfunc1() {
    { 
        echo "one"
        echo "two"
    }
    
    source /dev/stdin <<- SOURCED
        echo "three"
	SOURCED
}

myfunc2() {
    echo "myfunc2"
}

myfunc1
myfunc2
#!/bin/bash

print_article() {
    local body="$1"
    [ -z "$1" ] && { 
        local msg="arg1 must not be empty"
        echo "${msg}"
        exit 1
    }
    
    add_datetime_and_print <<- SOURCED
        "$body"
        Footer
	SOURCED
}

add_datetime_and_print() {
    local my_stdin
    
    printf "%(%Y-%m-%d %H:%M:%S)T\n"
    while read my_stdin
    do
        printf '%s\n' "${my_stdin}"
    done
}

print_article 'Hello World!'

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions