forked from rdiankov/openrave
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openrave_completion.bash.in
139 lines (131 loc) · 5.5 KB
/
openrave_completion.bash.in
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Programmable completion for openrave under bash. Source this file
# or add it to ~/.bash_completion or /etc/bash_completion.d
resource_types="json|dae|zae|xml|iv|vrml|wrl|stl|blend|3ds|ase|obj|ply|dxf|lwo|lxo|ac|ms3d|x|mesh.xml|irrmesh|irr|nff|off|raw|msgpack"
function _complete_openravepy {
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ $COMP_CWORD -ge 2 ]]; then
if [[ $COMP_CWORD == 2 ]]; then
case ${COMP_WORDS[1]} in
--listinterfaces)
opts="planner robot sensorsystem controller module inversekinematicssolver kinbody physicsengine sensor collisionchecker trajectory viewer spacesampler"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--example)
opts=`openrave@[email protected] --listexamples`
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--database)
opts=`openrave@[email protected] --listdatabases`
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
esac
else
# just add in the xml and dae files, we don't have auto-completations for the examples/databases yet
COMPREPLY=($(compgen -f -X "!*.+(${resource_types})" -- ${cur}))
return 0
fi
fi
case "${prev}" in
--level|-l)
opts="fatal error warn info debug verbose"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--collision)
opts=`openrave@[email protected] --listinterfaces collisionchecker`
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--viewer)
opts=`openrave@[email protected] --listinterfaces viewer`
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--physics)
opts=`openrave@[email protected] --listinterfaces physics`
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--loadplugin)
COMPREPLY=($(compgen -f -X "!*.so" -- ${cur}))
return 0
;;
*)
;;
esac
# not processing a current option, so offer all the options again
opts="--loadplugin --collision --physics --viewer --server --serverport --level --ipython --pythoncmd --listinterfaces --listplugins --listdatabases --listexamples --help"
if [[ $COMP_CWORD == 1 ]]; then
# these options transfer the args to another program
opts="$opts --database --example"
fi
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
if [[ ${cur} != -* ]] ; then
# add in xml and dae and zae files
COMPREPLY=($(compgen -f -X "!*.+(${resource_types})" -- ${cur}) ${COMPREPLY[@]})
fi
}
function _complete_openrave_robotpy {
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case "${prev}" in
--info)
opts="manipulators sensors links joints"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--list)
opts="manipulators sensors links joints"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--hash)
opts="body kinematics robot"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--manipname)
COMP_WORDS2=("${COMP_WORDS[@]}")
unset COMP_WORDS2[COMP_CWORD]
unset COMP_WORDS2[COMP_CWORD-1]
unset COMP_WORDS2[0]
opts=`openrave0.3-robot.py ${COMP_WORDS2[@]} --list manipulators`
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
--sensorname)
COMP_WORDS2=("${COMP_WORDS[@]}")
unset COMP_WORDS2[COMP_CWORD]
unset COMP_WORDS2[COMP_CWORD-1]
unset COMP_WORDS2[0]
opts=`openrave0.3-robot.py ${COMP_WORDS2[@]} --list sensors`
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
return 0
;;
*)
;;
esac
# not processing a current option, so offer all the options again
opts="--manipname --sensorname --hash --info --list --help"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
if [[ ${cur} != -* ]] ; then
# add in xml and dae and zae files
COMPREPLY=($(compgen -f -X "!*.+(${resource_types})" -- ${cur}) ${COMPREPLY[@]})
fi
}
function _complete_openrave_createpluginpy {
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="--usecore --planner --robot --sensorsystem --controller --module --iksolver --kinbody --physicsengine --sensor --collisionchecker --trajectory --viewer --spacesampler --help"
COMPREPLY=($(compgen -W "$opts" -- ${cur}))
}
complete -F "_complete_openravepy" -o filenames -o plusdirs "openrave.py"
complete -F "_complete_openrave_robotpy" -o filenames -o plusdirs "openrave-robot.py"
complete -F "_complete_openrave_createpluginpy" "openrave-createplugin.py"
complete -F "_complete_openravepy" -o filenames -o plusdirs "openrave@[email protected]"
complete -F "_complete_openrave_robotpy" -o filenames -o plusdirs "openrave@[email protected]"
complete -F "_complete_openrave_createpluginpy" "openrave@[email protected]"