Skip to content
Snippets Groups Projects
Commit ee93a3f3 authored by Simon Rose's avatar Simon Rose
Browse files

Merge branch 'complete' into 'master'

Complete

See merge request e3/e3-require!30
parents b321244d ebc88089
No related branches found
No related tags found
1 merge request!30Complete
......@@ -6,7 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## Bugfixes
### New Features
* Autocompletion for `iocsh.bash` has been added
### Bugfixes
* `iocsh.bash --help` (and variants) no longer loads tries to load `env.sh`.
## [3.4.1]
......
_iocsh_bash()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="-h -v -c -s -r"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
}
complete -o filenames -o nospace -o bashdefault -F _iocsh_bash iocsh.bash
#!/usr/bin/env bash
_iocsh_bash_completion()
{
local cur prev opts mods
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# -l should only autocomplete to directories
if [[ ${prev} == -l ]]; then
COMPREPLY=($(compgen -d -- ${cur}))
return 0
fi
# -e should only autcomplete to filenames
if [[ ${prev} == -e ]]; then
COMPREPLY=($(compgen -f -- ${cur}))
return 0
fi
# -r should try to determine modules
# Note that this does not return anything in cellMods, which would require us to
# determine what cellpath to use.
if [[ ${prev} == -r ]]; then
if [ -n "${EPICS_BASE}" ] && [ -n "${E3_REQUIRE_VERSION}" ]; then
mods=$(ls "${EPICS_BASE}/require/${E3_REQUIRE_VERSION}/siteMods/" 2>/dev/null)
COMPREPLY=($(compgen -W "$mods" -- ${cur}))
fi
return 0
fi
opts="-h -v -c -s -r -e -dg -dv -l -n"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
COMPREPLY=($(compgen -f -- ${cur}))
}
complete -o filenames -o nospace -o bashdefault -F _iocsh_bash_completion iocsh.bash
......@@ -352,6 +352,8 @@ E3_LD_LIBRARY_PATH="${EPICS_BASE}/lib/${EPICS_HOST_ARCH}:${E3_REQUIRE_LIB}/${EPI
LD_LIBRARY_PATH=$(set_variable "${old_ld_path}" "${E3_LD_LIBRARY_PATH}")
export LD_LIBRARY_PATH
# Add iocsh.bash autocompletion
source "${SRC_PATH}"/iocsh_complete.bash
print_env "$1"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment