Bug Description
Users running eval "$(goose term init bash)" in their ~/.bashrc encounter a syntax error:
$ source .bashrc
-bash: eval: line 29: syntax error near unexpected token `{{'
-bash: eval: line 29: `goose_preexec() {{'
Root Cause
In crates/goose-cli/src/commands/term.rs, the bash script template uses {{ and }} which is Rust's format string escape syntax for literal braces. However, the code uses .replace() for string substitution instead of format!(), so the double braces are output literally instead of being converted to single braces.
For example:
goose_preexec() {{
...
}}
Outputs goose_preexec() {{ instead of goose_preexec() {.
Proposed Fix
Change {{ to { and }} to } in the BASH_CONFIG template since .replace() is used instead of format!().
Environment
- goose version: 1.18.0
- Shell: bash
Steps to Reproduce
- Add
eval "$(goose term init bash)" to ~/.bashrc
- Run
source ~/.bashrc
- Observe syntax error
Bug Description
Users running
eval "$(goose term init bash)"in their~/.bashrcencounter a syntax error:Root Cause
In
crates/goose-cli/src/commands/term.rs, the bash script template uses{{and}}which is Rust's format string escape syntax for literal braces. However, the code uses.replace()for string substitution instead offormat!(), so the double braces are output literally instead of being converted to single braces.For example:
Outputs
goose_preexec() {{instead ofgoose_preexec() {.Proposed Fix
Change
{{to{and}}to}in theBASH_CONFIGtemplate since.replace()is used instead offormat!().Environment
Steps to Reproduce
eval "$(goose term init bash)"to~/.bashrcsource ~/.bashrc