bash-completion2ã ã¨$BASH_COMPLETION_DIRã¨ããã·ã§ã«å¤æ°ãç¡ã件
MacPortsã§$ sudo port install bash-completion
ããããbash-completionã®ãã¼ã¸ã§ã³ã2ç³»ã«ãªã£ã¦ã¾ããã1ç³»ããå¤ãã£ãé¨åãæãããããè£å®ã¯ã¡ããã¨åããã©Gitとプロンプト変数PS1とbash_completionと - kanonjiの日記ã§ã»ããããGItã®ãã©ã³ãåãããã³ããã«è¡¨ç¤ºãããã¤ãåããªãã£ãã®ã§ã調ã¹ã¦ã¿ã¾ããã
ã¾ã¨ã
$BASH_COMPLETION_DIRãç¡ããªã£ã
$BASH_COMPLETION_DIR
ã¨ããã·ã§ã«å¤æ°ããªããªã£ã¦ãã¦ã.bash_profile
ã«æ¸ããif [ -f $BASH_COMPLETION_DIR/git ]; then
ã¨ããifæã常ã«falseã«ãªã£ã¦ã¾ããã
/opt/local/share/bash-completion/completions/
$BASH_COMPLETION_DIR
ã«ä»£å
¥ããã¦ãããã¡ã¤ã«ãã¹ããåºæ¬çã«ã¯ç¡ããªã£ã¦ãã¾ãã代ããã«/opt/local/share/bash-completion/completions/
ã«ãåã³ãã³ãã®completionsãã¡ã¤ã«*1ãé
ç½®ããã¦ãã¾ãã
$ set | grep /opt/local/share/bash-completion/completions/
ãã®ãã¡ã¤ã«ãã¹ãä»£å ¥ãããã·ã§ã«å¤æ°ã¯ãã©ãããç¡ãã¿ããã
$BASH_COMPLETION_COMPAT_DIR
$ set | grep BASH_COMPLETION_COMPAT_DIR BASH_COMPLETION_COMPAT_DIR=/opt/local/etc/bash_completion.d
$BASH_COMPLETION_DIR
ã«ä»£å
¥ããã¦ãããã¡ã¤ã«ãã¹ã¯ãäºæç¨ã®ã·ã§ã«å¤æ°ã£ã½ãååã®$BASH_COMPLETION_COMPAT_DIR
ã«ä»£å
¥ããã¦ãã¾ããä»åã®ç°å¢ã§ã¯1ç³»ã®bash-completionãå
ã
å
¥ã£ã¦ç¡ãã£ãã®ã§/opt/local/etc/bash_completion.d
ã¯åå¨ãã¾ããã§ããã
__git_ps1çãå¥ãã¡ã¤ã«ã«ãªã£ã
# 3) Consider changing your PS1 to also show the current branch,
https://github.com/git/git/blob/v1.8.0/contrib/completion/git-completion.bash
# see git-prompt.sh for details.
https://github.com/git/git/blob/v1.8.0/contrib/completion/git-prompt.sh
1.8.0ãããªã®ããããå°ãåãããªã®ãåãããªããã©ãPS1ç°å¢å¤æ°ã使ã£ã¦ããã³ããã«gitã®ãã©ã³ãåãåºãã®ã«å¿ è¦ãªã³ã¼ãã¯ãå¥ãã¡ã¤ã«ã«åãåºããã¦ããæ§åã
$ vim .profile #.bash_profile ã .bashrcã§ãç°å¢ã«åãã㦠# bash_completion.d/git if [ -f $BASH_COMPLETION_DIR/git ]; then export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w$(__git_ps1) \n\[\033[01;34m\]\$\[\033[00m\] ' else export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' fiGitとプロンプト変数PS1とbash_completionと - kanonjiの日記
$ vim .profile #.bash_profile ã .bashrcã§ãç°å¢ã«åãã㦠# bash-prompt if [ -f /opt/local/share/git-core/git-prompt.sh ]; then . /opt/local/share/git-core/git-prompt.sh export PS1='\[\033[01;32m\]\u@\h\[\033[01;33m\] \w$(__git_ps1) \n\[\033[01;34m\]\$\[\033[00m\] ' else export PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ ' fi
ãããªæãã§åãæ¥ãåãæ§ã«ãã¾ããã
è£è¶³ã¨ä½è«
MacPortsã«ããbash-completionã®ã»ããã¢ããæé
howto/bash-completion – MacPorts
MacPortsã®Wikiã«ã»ããã¢ããæé ã解説ããã¦ãã¾ããMacæ¨æºã®bash 3.2ã§ã¯bash-completion 2ç³»ãåããªãã®ã§bash 4.1以ä¸ãè¨å®ãããã.bash_profileã«æ¸ãè¨å®ãè¼ã£ã¦ã¾ãã
MacPortsã§ããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ããéã常ã«+bash_completion variantsãæå®ãã
$ sudo vi /opt/local/etc/macports/variants.conf
+bash_completion
ãã®ãã¡ã¤ã«ã«ã常ã«ä½¿ãããvariantsãè¨å®åºæ¥ãã¿ããã§ãã
.bash_profileããèªã¿è¾¼ããã¡ã¤ã«
$ ls -al /opt/local/etc/bash_completion lrwxr-xr-x 1 root admin 43 7 6 07:17 /opt/local/etc/bash_completion -> /opt/local/etc/profile.d/bash_completion.sh
ãã®æ§ã«ã·ã³ããªãã¯ãªã³ã¯ãè²¼ã£ã¦ããã¾ãã
/opt/local/etc/bash_completion
å
ãã/opt/local/share/bash-completion/bash_completion
ãå¼ã°ãã¦ãã¾ãããã®ä¸ã§ãåè¿°ã®$BASH_COMPLETION_COMPAT_DIR
ãå®ç¾©ããã¦ãããã¾ãã
ç°å¢
Mac | Mac OS X 10.7.4ï¼Lionï¼ |
git-core | @1.8.0_0+bash_completion+credential_osxkeychain+doc+pcre+python27 |
bash-completion | @2.0_1 |
æ¸ããæ¥
2012-11-21
ã¡ãã£ã¨ã»ã£ã¨ãããã©ãããªã«æ¥ã¯çµã£ã¦ãªãã
*1:ã¨å¼ãã§ããã®ãåãããªããã©