fizyr / subst

Apache License 2.0
10 stars 4 forks source link

Parameter expansion of default values is not following POSIX #19

Open D-Brox opened 1 month ago

D-Brox commented 1 month ago

The syntax ${variable:default} is not one of the 8 valid cases described on the POSIX specifications:

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02

de-vri-es commented 1 month ago

That's true. This crate is "shell-like" substitution. It does not aim to be POSIX compatible.

D-Brox commented 1 month ago

True, it's shell-like, but it would still be desirable if at least ${variable:-default} was also valid.

de-vri-es commented 1 month ago

I'm sorry, but this has never been a goal of the library. Being compatible with POSIX is much more complicated than what this crate aims to be.

D-Brox commented 1 month ago

No problem, I can work around this.

Can you take a look at #18 later? It has both an enhancement (permissive and partial substitution modes) and a fix for nested substitutions.

de-vri-es commented 1 month ago

Yeah. I've been busy in a move lately, but I will try to get to it :)