Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recipe attribute to customize string separating variadic parameters? #2370

Open
laniakea64 opened this issue Sep 15, 2024 · 1 comment
Open

Comments

@laniakea64
Copy link
Contributor

Related to #647 (comment)

Currently just always separates variadic parameters with the string " ". Now that just has escaping of arbitrary characters, should there be a recipe attribute to customize the variadic separator string for individual recipe?

This could allow shebang recipes to work with variadic parameters as lists where the values may contain spaces: the variadic delimiter string could be set to something vanishingly unlikely, e.g. null character \u{0}, and the shebang recipe's interpreter could split on that and internally work with a list variable.

For linewise recipes, this would make more opportunity for just to have a quote_each function like suggested in the other issue, its signature could be quote_each(string, input_delimiter_string) and it return each quoted string separated by space.

@casey
Copy link
Owner

casey commented Sep 17, 2024

This is a really interesting thought. We could have a separate function, or we could give quote() an optional second argument, which is an optional input_delimiter. Although, an advantage a separate function like quote_each, would be that if the delimiter is omitted, it could default to \0, so you wouldn't need to specify the separator in multiple places.

This does feel super hacky though. I would really prefer doing what was proposed in #208, which is to allow values which are lists of strings, so that quoting can interact correctly with var args. But, I've been talking about that for a while and still haven't done it 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants