Re: [PATCH] config: add an includeIf.env{Exists,Bool,Is,Match}
- From
Jeff King <peff@peff.net>
- Date
- Sep 27, 2021, 21:37 UTC
- Message-ID
- <YVI5rYamHBkGQ/jy@coredump.intra.peff.net>
- In-Reply-To
- <00ee01d7b3e1$ceb06840$6c1138c0$@nexbridge.com>
On Mon, Sep 27, 2021 at 04:53:59PM -0400, Randall S. Becker wrote:
Show 10 quoted lines
> What about something like: > > [includeIf "env:PATH ~= '^(.*😊)/usr/bin(:.*)*$' "] > > Using single quotes and a full regex pattern instead of trying to > provide a syntax to extract a pattern and then match. One call to > regexec() would be easier. Then escaping is regcomp's problem > (mostly). Potentially, you could even remove the outer ", but that > would be wonky. You could omit the ^ and $ by default assuming a full > match.
I almost suggested that, but then...how do you put single-quotes in your pattern? You can backslash-escape them, but:
- do you need to escape the backslash to get it through the config
parser intact? - it seems extra funny to me because single quotes usually imply a
lack of interpolation-Peff