Nope. The function I'd like to use is too complex for a standard function (it's a Git prompt - like I use it in bash). I'm looking for method to produce a new string before the prompt returns, and PROMPT just spitting out that string. Linux btw. does it by providing a callback hook ($PROMPT_COMMAND). But in TCC I haven't seen anything the like.
You might also try the special alias POST_EXEC. Being an alias, it can have several commands (separated by "&"), or it can execute complicated.btm. In any event, if POST_EXEC creates my_prompt_string and then (lastly) does "SET PROMPT=my_prompt_string", it should work.
@charles
Wasn't aware that %@execstr[] could call BTM files. However this seems to be slower than using the alias approach (@Rex: could you comment on this?). Also, this approach suffers from the below problem too.
@vince
Unfortunately setting PROMPT in tcstart.btm seems to be treated differently. Setting PROMPT from the command line (e.g. set prompt=%_PID%$s%%git_prompt%%$g$s) works (set PROMPT gives me: <some_pid>$s%git_prompt%$g$s); setting PROMPT in tcstart.btm (same assignment) doesn't work (set PROMPT gives me: <some_pid>$s$g$s), the variable gets eliminated.
I also tried `%...%`, ^%...^%,`%%...%%`, and ^%^%...^%^%, to no avail.
@vince
Seems my understandig of %s to reference variables was too CMD-bound. %[...] obviously behaves like ${...} in the bash; wasn't aware of that...
One ugliness remains though: when starting a new TCC session, POST_EXEC is not executed prior to the first prompt. Of course one might argue "No command was executed before this first prompt", and would be correct. It would be nice however, to have the desired information right in the first prompt i.e. w/o having to resort to call the POST_EXEC alias manually once.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.