contrib/bash_completion
changeset 1556 561b17b7d3a2
parent 1555 01a5121a005a
child 1587 851bc33ff545
equal deleted inserted replaced
1555:01a5121a005a 1556:561b17b7d3a2
     5     local all commands result
     5     local all commands result
     6 
     6 
     7     all=($(hg --debug help | sed -e '1,/^list of commands:/d' \
     7     all=($(hg --debug help | sed -e '1,/^list of commands:/d' \
     8 				 -e '/^global options:/,$d' \
     8 				 -e '/^global options:/,$d' \
     9 				 -e '/^ [^ ]/!d; s/^ //; s/[,:]//g;'))
     9 				 -e '/^ [^ ]/!d; s/^ //; s/[,:]//g;'))
    10     
    10 
    11     commands="${all[*]##debug*}"
    11     commands="${all[*]##debug*}"
    12     result=$(compgen -W "${commands[*]}" -- "$cur")
    12     result=$(compgen -W "${commands[*]}" -- "$cur")
    13 
    13 
    14     # hide debug commands from users, but complete them if
    14     # hide debug commands from users, but complete them if
    15     # there is no other possible command
    15     # there is no other possible command
   166 	    else
   166 	    else
   167 		COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -- "$cur" ))
   167 		COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -- "$cur" ))
   168 	    fi
   168 	    fi
   169 	;;
   169 	;;
   170 	*)
   170 	*)
   171             COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -- "$cur" ))
   171 	    COMPREPLY=(${COMPREPLY[@]:-} $( compgen -f -- "$cur" ))
   172 	;;
   172 	;;
   173     esac
   173     esac
   174 
   174 
   175 }
   175 }
   176 
   176