Skip to content

Function Calls Spanning Multiple Lines #965

@M4C4R

Description

@M4C4R

Question

Is it possible to split function calls across multiple lines for readability? I can't seem to figure it out.

Explanation

The below works:

#@ def some_list(a,b,c):
- #@ a
- #@ b
- #@ c
#@ end

--- #@ some_list("this is a long line", "i'd rather split this", "how do I do it?")

But this does not:

#@ def some_list(a,b,c):
- #@ a
- #@ b
- #@ c
#@ end

--- #@ some_list(
    #@   "this is a long line",
    #@   "i'd rather split this",
    #@   "how do I do it?"
    #@ )

Error:

- got string literal, want ','
    def.yml:8 |     #@   "this is a long line",

Workaround

#@ def some_list(a,b,c):
- #@ a
- #@ b
- #@ c
#@ end

#@ some_list_args = [
#@   "this is a long line",
#@   "i'd rather split this",
#@   "how do I do it?"
#@ ]
--- #@ some_list(*some_list_args)

Metadata

Metadata

Assignees

No one assigned

    Labels

    carvel triageThis issue has not yet been triaged for relevancestaleThis issue has had no activity for a while and will be closed soon

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions