Re: [PATCH] Add __git_ps1_pc to use as PROMPT_COMMAND

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael J Gruber <git@xxxxxxxxxxxxxxxxxxxx> writes:

> Junio C Hamano venit, vidit, dixit 01.10.2012 23:09:
>
>> Confused....
>> 
>
> The "problem" (as far as I see) is only: What user interface do we want
> to expose to the user, or rather, do we want to expose the user to ;)
>
> So far, we say:
>
> #    1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
> #    2) Add the following line to your .bashrc/.zshrc:
> #        source ~/.git-prompt.sh
> #    3) Change your PS1 to also show the current branch:
> #         Bash: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
> #         ZSH:  PS1='[%n@%m %c$(__git_ps1 " (%s)")]\$ '
>
> (That's incomplete for zsh, but I'm digressing...). With the above, we
> would change the bash instruction to
>
> PROMPT_COMMAND='
> 	PS1=$(printf "\u \h \w %s$ " $(__git_ps1 "%s"))
>        '
>
> which may look more complicated to some. I think we can aim for
> something like
>
> PROMPT_COMMAND='__git_ps1_color "\u \h \w%s$ " " (%s)"'

If your goal is to use PROMPT_COMMAND and not PS1, then yes between
the two definitions of PROMPT_COMMAND above, the latter may look
simpler.  But that does not explain why you want to prefer it over
PS1 in the first place, which was the central point of my question
that still has not been answered.

Even more confused...

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]