diff options
author | Adam Malinowski <a.malinowsk2@partner.samsung.com> | 2016-02-26 08:39:35 +0100 |
---|---|---|
committer | Adam Malinowski <a.malinowsk2@partner.samsung.com> | 2016-04-26 17:43:06 +0200 |
commit | 9ed2d0cc067bc5b54acf8f5af81a9bc03c29560b (patch) | |
tree | 3437d91b63801aa61c8429ea9101adfb00bf77f6 /etc/bash_completion.d | |
parent | c41eceb9d751bdf642d32d2dfc7cb299c85e6467 (diff) | |
download | sd-mux-ansible.tar.gz sd-mux-ansible.tar.bz2 sd-mux-ansible.zip |
Add bash completion scriptansible
Change-Id: I281d9c9a72ba8b764de855fd5ebb38d6b4399ca1
Diffstat (limited to 'etc/bash_completion.d')
-rw-r--r-- | etc/bash_completion.d/sd-mux-ctrl | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/etc/bash_completion.d/sd-mux-ctrl b/etc/bash_completion.d/sd-mux-ctrl new file mode 100644 index 0000000..7fd4de7 --- /dev/null +++ b/etc/bash_completion.d/sd-mux-ctrl @@ -0,0 +1,45 @@ +# Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# @file sd-mux-ctrl +# @author Adam Malinowski <a.malinowsk2@partner.samsung.com> +# + +_sdmux() +{ + local cur prev opts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="--help --usage --list --device-serial --device-id --show-serial --info --status --init --tick --tick-time --dut --ts --vendor --pins --invert" + + case "${prev}" in + --device-serial) + local running=$(sd-mux-ctrl -l | awk '/Serial/ {gsub(",$", "", $6); print $6}') + COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) + return 0 + ;; + --device-id) + local running=$(sd-mux-ctrl -l | awk '/Serial/ {gsub(",$", "", $6); print $6}') + COMPREPLY=( $(compgen -W "${running}" -- ${cur}) ) + return 0 + ;; + *) + ;; + esac + + COMPREPLY=($(compgen -W "${opts}" -- ${cur})) + return 0 +} +complete -F _sdmux sd-mux-ctrl |