File: fossil-autocomplete.bash

package info (click to toggle)
fossil 1%3A2.26-2
  • links: PTS
  • area: main
  • in suites: sid, trixie
  • size: 28,572 kB
  • sloc: ansic: 332,171; tcl: 14,144; javascript: 10,171; sh: 6,791; makefile: 4,276; pascal: 1,139; cpp: 1,001; cs: 879; sql: 376; asm: 281; perl: 166; xml: 95
file content (15 lines) | stat: -rwxr-xr-x 544 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Command name completion for Fossil.
# Mailing-list contribution by Stuart Rackham.
function _fossil() {
    local cur commands
    cur=${COMP_WORDS[COMP_CWORD]}
    commands=$(fossil help --all)
    if [ $COMP_CWORD -eq 1 ] || [ ${COMP_WORDS[1]} = help ]; then
        # Command name completion for 1st argument or 2nd if help command.
        COMPREPLY=( $(compgen -W "$commands" $cur) )
    else
        # File name completion for other arguments.
        COMPREPLY=( $(compgen -f $cur{}) )
    fi
}
complete -o default -F _fossil fossil f