/usr/share/bash-completion/completions/caffe is in caffe-tools-cpu 1.0.0~rc4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | # bash completion for Caffe's command line utility -*- shell-script -*-
# COPYRIGHT (C) 2015,2016 Zhou Mo <cdluminate@gmail.com>
# License: BSD-2-Clause
# Originally appeard at https://github.com/BVLC/caffe/issues/3149
# Updated for caffe (1.0.0~rc3+20160715-g42cd785)
_caffe()
{
local cur prev words cword
_init_completion -s || return
local prototxts='@(prototxt)'
local caffemodels='@(caffemodel,binaryproto)'
local solverstates='@(solverstate)'
local caffefiles='@(prototxt|caffemodel|solverstate)'
local flags='-gpu -iterations -model -snapshot -solver -weights -sighup_effect -sigint_effect -level -stage -phase'
if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W 'train test time device_query' -- "$cur" ) )
return 0
fi
if [[ $cword -eq 2 ]]; then
case ${words[1]} in
train|test|device_query|time)
COMPREPLY=( $( compgen -W "$flags" -- "$cur") )
return 0
;;
*)
return 0
;;
esac
fi
case $prev in
-gpu|-iterations|-version|-level|-stage)
return 0
;;
-solver|-model)
_filedir $prototxts
return 0
;;
-weights)
_filedir $caffemodels
return 0
;;
-snapshot)
_filedir $solverstates
return 0
;;
-sighup_effect|-sigint_effect)
COMPREPLY=( $( compgen -W 'snapshot stop none' -- "$cur") )
return 0
;;
-phase)
COMPREPLY=( $( compgen -W 'TRAIN TEST' -- "$cur") )
return 0
;;
*)
COMPREPLY=( $( compgen -W "$flags" -- "$cur") )
return 0
;;
esac
# file completion on relevant files
_filedir "$caffefiles"
return 0
}
complete -F _caffe caffe
# vim
|