- Oct
- 9
- 0
I haven't used Take Command/TCC in years. Now, I'm struggling with a simple? task and the documentation. Here is what I would like to do:
I want to create a custom prompt that appends the git branch, if the current directory is in fact a git repository. I'm close, but I am flailing at the last step. Here is what I have so far:
It sort of works, once, but I want it to be invoked every time I change directories. Also, I must be doing something wrong because if I run the prompt command outside of a git branch, the gitbranch function is still being executed. (It seems I should be using IFF instead of @IF, but I can't figure out how to get that to work either).
Also, is there an easy way to debug such things?
I want to create a custom prompt that appends the git branch, if the current directory is in fact a git repository. I'm close, but I am flailing at the last step. Here is what I have so far:
Code:
function gitbranch=`%@word[1,%@execstr[git branch]]`
prompt %@if[direxist .git,$P$s(%@gitbranch[])$g,$P$g]
It sort of works, once, but I want it to be invoked every time I change directories. Also, I must be doing something wrong because if I run the prompt command outside of a git branch, the gitbranch function is still being executed. (It seems I should be using IFF instead of @IF, but I can't figure out how to get that to work either).
Also, is there an easy way to debug such things?
Last edited: