Repository navigation
New cli_extract_vars for metaprogramming on {cli} strings - #847
Conversation
Alternatives Considered
|
b28fc0e to
ab56a05
Compare
|
This now includes #848, for now, to get CI passing. GitHub doesn't allow PR stacking from fork to upstream, but you can check the 'dummy' stack on my fork: |
b0b35a3 to
b9ee42f
Compare
|
Thanks! Can you undo the changes that are not related to your PR? |
caf287f to
98c9387
Compare
done, rebased |
|
In general I am a bit worried about promising that this function will work well, especially that I am planning on rewriting the string interpolation in cli. We can add it, I understand that it'll be an improvement, but maybe catch errors in lintr and maybe suggest catching errors in the Relatedly, are these expected? > cli_extract_vars("{?s} {a} and {b}")
Error in post_process_plurals(pstr, values) :
Multiple quantities for pluralization
> cli_extract_vars("bad {?s}")
Error in post_process_plurals(pstr, values) :
Cannot pluralize without a quantity
> cli_extract_vars("{vapply(x, function(i) i + 1, 1)}")
[1] "vapply" "x" "function" "+" "i" |
If that's an imminent thing, I'd be happy to defer this if you think it'll be more straightforward to do ex post. For your examples:
|
811e565 to
61a8cb6
Compare
|
Thanks! |
Closes #750. Co-written with Gemini.