Commit 1e5777b5 authored by assafmendelson's avatar assafmendelson Committed by Konstantinos Tsakalozos
Browse files

Added automatic bash completion for docker, kubectl and istioctl (#254)

parent 426f23aa
......@@ -41,8 +41,10 @@ apps:
daemon: simple
command: microk8s-kubectl.wrapper
completer: kubectl.bash
command: microk8s-docker.wrapper
completer: docker.bash
command: sudo SNAP_DATA=${SNAP_DATA} ${SNAP}/
......@@ -61,6 +63,7 @@ apps:
command: microk8s-reset.wrapper
command: microk8s-istioctl.wrapper
completer: istioctl.bash
......@@ -185,16 +188,29 @@ parts:
# Istio support
rm "actions/"
rm "actions/"
# added because the completer is still defined
touch istioctl.bash
# Istio addon
echo "Preparing istio"
cp $KUBE_SNAP_BINS/istioctl .
cp -r $KUBE_SNAP_BINS/istio-yaml ./actions/istio
# Add bash completion for istioctl. This is located here to make sure it is only added when istio is added.
./istioctl collateral completion --bash -o .
sed -i "s/complete -o default -F __start_istioctl istioctl/complete -o default -F __start_istioctl microk8s.istioctl/g" istioctl.bash
sed -i "s/complete -o default -F __start_istioctl istioctl/complete -o default -o nospace -F __start_istioctl microk8s.istioctl/g" istioctl.bash
echo "Creating inspect hook"
cp $KUBE_SNAP_ROOT/scripts/ .
# Add bash completion for microk8s.docker
cp $SNAPCRAFT_STAGE/usr/share/bash-completion/completions/docker docker.bash
sed -i "s/complete -F _docker docker docker.exe dockerd dockerd.exe/complete -F _docker microk8s.docker/g" docker.bash
# Add bash completion for microk8s.kubectl.
./kubectl completion bash | sed "s/complete -o default -F __start_kubectl kubectl/complete -o default -F __start_kubectl microk8s.kubectl/g" | sed "s/complete -o default -o nospace -F __start_kubectl kubectl/complete -o default -o nospace -F __start_kubectl kubectl/g" > kubectl.bash
snapcraftctl build
# Unfortunately we cannot add package repositories to our snaps
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment