Skip to content
Snippets Groups Projects
Commit fde4d029 authored by Cristiano Urban's avatar Cristiano Urban
Browse files

Added bash-completion scripts for 'vos_data', 'vos_job' and 'vos_storage' cli commands.

parent 6e24cb73
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,9 @@ COPY *.py \
vos_storage /usr/bin/vos_cli/
RUN chmod -R 755 /usr/bin/vos_cli
# Copy bash-completion scripts
COPY config/bash_completion/* /usr/share/bash-completion/completions/
# Copy configuration file
RUN mkdir -p /etc/vos_cli
COPY config/vos_cli.conf /etc/vos_cli/
......@@ -31,5 +34,10 @@ USER client
# Set up a workdir for the container
WORKDIR /home/client/
# Source bash-completion scripts
RUN echo ". /usr/share/bash-completion/completions/vos_data" >> .bashrc && \
echo ". /usr/share/bash-completion/completions/vos_job" >> .bashrc && \
echo ". /usr/share/bash-completion/completions/vos_storage" >> .bashrc
# Install python dependencies
RUN pip3.9 install --no-cache-dir redis tabulate
_vos_data()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="cstore hstore"
if [[ ${cur} == ?store || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _vos_data vos_data
_vos_job()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="info list results"
if [[ ${cur} == info || ${cur} == results || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
if [[ ${prev} == list ]] ; then
status="completed error executing pending queued"
COMPREPLY=( $(compgen -W "${status}" -- ${cur}) )
return 0
fi
}
complete -F _vos_job vos_job
_vos_storage()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="add del list"
if [[ ${cur} == add || ${cur} == del || ${cur} == list || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -F _vos_storage vos_storage
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment