Open osheari1 opened 6 days ago
hello @osheari1 yes, you're correct.
the user input and pattern are combined an then the template system tries to resolve all double brace pairs. {{ }} A work around might be just to provide a variable. -v=req:""
potentially we could have --novars or something to disable substitution.
Hello!
I'm wondering if in the long run, a more robust solution would be needed... :thinking:
Thinking of two cases:
{{...}}
syntax (eg. Jekyll and other template libs),Pattern
# Example Output
// Some example explaining Jekyll syntax
{{ jekyll-var-no-sub-wanted }}
# Output
{{ some-fabric-variable }}
Input
Stuff {{ fabric-var-no-sub-wanted }}
Here, {{ fabric-var-no-sub-wanted}}
and {{ jekyll-var-no-sub-wanted }}
would both throw errors.
Problem
{{...}}
syntax in prompt and input are substitution targets. Aka fabric doesn't know which variable should require substitution.
Questions
For example, say you have a pipeline, cat ... | fabric ... | command A | fabric ... | command B | fabric ...
: Depending on the task, you won't necessarily know what output the fabric commands will produce. Meaning, in some cases, they may produce instances of {{...}}
in intermediary steps, which will then, without the users knowledge, attempt to be substituted by fabric in later calls.
For example,
$ cat stuff.txt | sed 's/{{var}}/subbed/g' | fabric -p do_stuff
Solutions?
\{\{ escaped-jekyll \}\}
. I'll admit, I did not consider folk would want to process jekyll templates when I made the template system.
I do use variables in input, it useful and think this will be increasingly useful when extension are available.
Probably the simplest approaches to this are
Yeah I think that will work if it applies specifically to INPUT vars.
There are two cases where this issue could pop up:
--novars
, if --novars only applies to INPUT vars only.Is there something that could be done about the first case as well?
Honestly I think it's just easier to not fail on missing vars.
What happened?
With a prompt, such as
improve_security_policy
piping into
improve_prompt
returnsExpected behavior: Improve prompt would work on patters with variables / plugins / other future stuff that may be added to the templating features.
I'm assuming this is because variables are validated after stdin is substituted into the template.
Version check
Relevant log output
No response
Relevant screenshots (optional)
No response