2012-01-17 33 views

答えて

2

それは私が行うとき、私の作品:

  1. wgetコマンドをhttp://www.triquanta.nl/sites/default/files/git-flow.bash
  2. ソースはgit-flow.bash
  3. 別名F = 'gitのフロー機能'
  4. 完全に-F __git_flow_feature
  5. をF
  6. f タブタブ
とにかく

の最も一般的な理由「[:1:単項演算子は、予想される」:

if [ 1 = $MYVAL ] 

とあなたのMYVALが設定されていない。エラーはあなたのようなシェルスクリプトコードを持っているということです完了機能を検査してください。デバッグするにはset -xを追加できます。

通常最も簡単な解決策は、オペレータが空の引数を取得するように、変数を引用しているが、正しい数の引数があります:

if [ 1 = "$MYVAL" ] 
+1

にレポでバイナリをコピーし :

wget -O ~/.git-completion.bash https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash wget -O ~/.git-flow-completion.bash https://raw.githubusercontent.com/petervanderdoes/git-flow-completion/develop/git-flow-completion.bash 

Gitの数がここで注目 – Daenyth

2

を私もこの問題を抱えていたし、すべてのGoogle検索はバックに私を導きますこの郵便受け。

私はミハエルの答えとDaenythのコメントを使用したソリューションを掲示しています

...

私のgit-flow.bashは同一であったが、私は、私たちのgit完了ファイルが変化するかもしれないと思います。

# __git_find_on_cmdline requires 1 argument 
__git_find_on_cmdline() 
{ 
local word subcommand c=1 
while [ $c -lt $cword ]; do 
    word="${words[c]}" 
    for subcommand in $1; do 
     if [ "$subcommand" = "$word" ]; then 
      echo "$subcommand" 
      return 
     fi 
    done 
    c=$((++c)) 
done 
} 

新:

# __git_find_on_cmdline requires 1 argument 
__git_find_on_cmdline() 
{ 
local word subcommand c=1 
while [[ $c -lt $cword ]]; do 
    word="${words[c]}" 
    for subcommand in $1; do 
     if [ "$subcommand" = "$word" ]; then 
      echo "$subcommand" 
      return 
     fi 
    done 
    c=$((++c)) 
done 
} 

お知らせ私が追加する必要がありましたダブルブラケット

は私のGitの完成ファイルは /etc/bash_completion.d/git

旧に位置変更するために、私が持っていたこの問題を解決するために、新しいコード。それが私が作った唯一の変化でした。

+0

私のために働いていない、まだ同じエラー[:1:単項演算子が期待 – decebal

2

なぜgit-flow-completionを使用しないのですか? bashのするための手順は以下のとおりです。

$ cd /etc/bash_completion.d 
$ sudo wget https://raw.githubusercontent.com/bobthecow/git-flow-completion/master/git-flow-completion.bash 
$ exec $SHELL 

zshまたはfishのための説明書もあります。

alias gn="git-number" 
alias gb="gn -c git blame" 
alias ge="gn -c $EDITOR" 
alias ga="gn add" 
alias gr="gn -c git reset" 
alias gap="EDITOR='$EDITOR -w' gn add -p" 
alias gd="gn -c git diff -b -w --ignore-blank-lines" 
alias gds="gd --staged" 
alias gc="gn -c git checkout" 
alias gcf="git flow feature checkout" 
alias gl="gn -c git log -w -b -p --ignore-blank-lines" 
alias gls="git log --stat" 
alias cm="EDITOR='$EDITOR -w' git commit" 
alias grb="git stash save 'REBASE' && EDITOR='$EDITOR -w' git rebase -i" 
alias grbc="EDITOR='$EDITOR -w' git rebase --continue" 

gcd() { 
    test -n "$1" && cd $(dirname $(git list $1)) 
} 

source ~/.git-completion.bash 
__git_complete gn _git 
__git_complete ga _git_add 
__git_complete gap _git_add 
__git_complete gd _git_diff 
__git_complete gds _git_diff 
__git_complete gc _git_checkout 
__git_complete gcf _git_checkout 
__git_complete gl _git_log 
__git_complete gls _git_log 
__git_complete cm _git_commit 

source ~/.git-flow-completion.bash 

としてcompletionスクリプトをインストールします:それはbashがありますのでhttps://github.com/holygeek/git-numberちょうど~/bin

1

私はこの別名を持ちます`[` `の代わりに[[` `を使用してください。それはずっと賢く
関連する問題