File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
core/imageroot/etc/profile.d Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -10,3 +10,35 @@ if [ -n "${AGENT_STATE_DIR}" ] && [ -f "${AGENT_STATE_DIR}/agent.env" ]; then
1010 . ${AGENT_STATE_DIR} /agent.env
1111 export PATH
1212fi
13+
14+ if [ -z " $BASH " ]; then
15+ return
16+ fi
17+
18+ _runagent_wastyped ()
19+ {
20+ local xword checkword=" $1 "
21+ for xword in " ${COMP_WORDS[@]} " ; do
22+ if [[ " ${xword} " == " ${checkword} " ]]; then
23+ return 0
24+ fi
25+ done
26+ return 1
27+ }
28+
29+ _runagent_completions ()
30+ {
31+ local cword=" $2 "
32+ local agents=()
33+
34+ if _runagent_wastyped " -l" || _runagent_wastyped " --list-modules" ; then
35+ :
36+ elif _runagent_wastyped " -m" || _runagent_wastyped " --module-id" ; then
37+ agents+=($( runagent --list-modules | sort | grep ^" ${cword} " ) )
38+ COMPREPLY+=($( compgen -W " ${agents[*]} " -- " ${cword} " ) )
39+ else
40+ COMPREPLY+=($( compgen -W " --list-modules --module-id --current-dir --help" -- " ${cword} " ) )
41+ fi
42+ }
43+
44+ complete -F _runagent_completions runagent
You can’t perform that action at this time.
0 commit comments