On Mon, Aug 27, 2012 at 6:07 PM, <[email protected]> wrote:
> I have a fossil repository where I keep my vim settings in different
> branches. Here is an example output of branch listing:
>
> $ fossil branch
> * trunk
> vim-7.3.000-i486-1-custom
> vim-7.3.000-i486-1-default
> vim-7.3.154-x86_64-1-custom-big
>
> Now, to checkout the last branch in this list, I have to copy paste the
> whole name with the mouse and do:
>
> $ fossil co vim-7.3.154-x86_64-1-custom-big
>
> I'd be very happy if I could just type:
>
> $ fossil co vim-7.3.154
Expanding on the bash completion script previously published in this list
by Stuart Rackham, this would give you tab completion on branch names:
# Command name completion for Fossil.
function _fossil() {
local cur commands branches
cur=${COMP_WORDS[COMP_CWORD]}
if [ $COMP_CWORD -eq 1 ] || [ ${COMP_WORDS[1]} = help ]; then
# Command name completion for 1st argument or 2nd if help command.
commands=$(fossil help --all)
COMPREPLY=( $(compgen -W "$commands" $cur) )
elif [ ${COMP_WORDS[1]} = update ] || [ ${COMP_WORDS[1]} = co ] ||
[ ${COMP_WORDS[1]} = checkout ]; then
branches=$(fossil branch ls | cut -c2-)
COMPREPLY=( $(compgen -W "$branches" $cur) )
else
# File name completion for other arguments.
COMPREPLY=( $(compgen -f $cur) )
fi
}
complete -o default -F _fossil fossil f
alias f='fossil'
/Peter
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users