-
Notifications
You must be signed in to change notification settings - Fork 3
/
ycmd-python
executable file
·37 lines (32 loc) · 1.13 KB
/
ycmd-python
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
#!/bin/sh
# The name of this script /must/ end with 'python', else YouCompleteMe will not
# use this as the server.
# Remove the path to ycmd if given, as we are using our own.
if [ -d "$1" ]; then
shift
fi
get_arg() {
key="$1"
shift
echo "$@" | sed -r "s/.*--${key}=([^ ]+).*/\1/"
}
port="$(get_arg port "$@")"
options_file="$(get_arg options_file "$@")"
idle_suicide_seconds="$(get_arg idle_suicide_seconds "$@")"
# We use:
# --publish=<port>:<port> so we communicate with ycmd
# --rm to kill the container once we're done with it.
# --volume=${HOME}:${HOME} to pick up our code (and .ycm_extra_conf.py).
# --volume=<options_file>:<options_file>:ro to set up the server with the info it needs to accept requests from the client.
# --host=0.0.0.0 since Docker desires that we bind servers to listen on this address.
docker run \
--name="ycmd-$$" \
--rm \
--publish="${port}:${port}" \
--volume="${HOME}:${HOME}" \
--volume="${options_file}:${options_file}:ro" \
alexandrecarlton/ycmd \
--host='0.0.0.0' \
--port="${port}" \
--options_file="${options_file}" \
--idle_suicide_seconds="${idle_suicide_seconds}"