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

RFE: Add shorthand syntax for default macro values #1756

Open
pmatilai opened this issue Aug 17, 2021 · 3 comments
Open

RFE: Add shorthand syntax for default macro values #1756

pmatilai opened this issue Aug 17, 2021 · 3 comments
Labels
handsfree Packaging automation and convenience RFE

Comments

@pmatilai
Copy link
Member

A common use-case with macros is wanting to fallback to a default value if the macro in question doesn't exist, eg "use value of %foo if defined, or 5 otherwise". This seems unnecessarily clumsy in the current macro implementation: %{?foo}%{!?foo:5} and the new expression stuff doesn't seem to help here.

@mlschroe
Copy link
Contributor

Just thinking out loud:

%{!foo:bar}
%{?foo-bar}

@pmatilai
Copy link
Member Author

pmatilai commented Oct 26, 2021

More thinking out loud, %{foo|bar} as a shorthand for the actual expression (%["%{?foo}" || "bar"])

@mlschroe
Copy link
Contributor

Ohh, non-emptyness instead of plain definedness? Like in most shells: ${foo-bar} versus ${foo:-bar}...

@pmatilai pmatilai added the handsfree Packaging automation and convenience label Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
handsfree Packaging automation and convenience RFE
Projects
Status: Backlog
Development

No branches or pull requests

2 participants