Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions sonic-utilities-data/bash_completion.d/acl-loader
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
_acl_loader_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_ACL_LOADER_COMPLETE=complete $1 ) )
return 1
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _ACL_LOADER_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _acl_loader_completion -o default acl-loader;
_acl_loader_completion_setup() {
complete -o nosort -F _acl_loader_completion acl-loader
}

_acl_loader_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/config
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_config_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_CONFIG_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _CONFIG_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _config_completion -o default config;
_config_completion_setup() {
complete -o nosort -F _config_completion config
}

_config_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/connect
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_connect_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_CONNECT_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _CONNECT_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _connect_completion -o default connect;
_connect_completion_setup() {
complete -o nosort -F _connect_completion connect
}

_connect_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/consutil
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_consutil_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_CONSUTIL_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _CONSUTIL_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _consutil_completion -o default consutil;
_consutil_completion_setup() {
complete -o nosort -F _consutil_completion consutil
}

_consutil_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/counterpoll
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_counterpoll_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_COUNTERPOLL_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _COUNTERPOLL_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _counterpoll_completion -o default counterpoll;
_counterpoll_completion_setup() {
complete -o nosort -F _counterpoll_completion counterpoll
}

_counterpoll_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/crm
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_crm_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_CRM_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _CRM_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _crm_completion -o default crm;
_crm_completion_setup() {
complete -o nosort -F _crm_completion crm
}

_crm_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/debug
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_debug_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_DEBUG_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _DEBUG_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _debug_completion -o default debug;
_debug_completion_setup() {
complete -o nosort -F _debug_completion debug
}

_debug_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/dump
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_dump_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_DUMP_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _DUMP_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _dump_completion -o default dump
_dump_completion_setup() {
complete -o nosort -F _dump_completion dump
}

_dump_completion_setup;
31 changes: 24 additions & 7 deletions sonic-utilities-data/bash_completion.d/fwutil
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
shopt -s extglob

_fwutil_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_FWUTIL_COMPLETE=complete $1 ) )
COMPREPLY=( ${COMPREPLY[*]//*(-install|-update)/} )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _FWUTIL_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _fwutil_completion -o default fwutil;
_fwutil_completion_setup() {
complete -o nosort -F _fwutil_completion fwutil
}

_fwutil_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/pddf_fanutil
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_pddf_fanutil_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_PDDF_FANUTIL_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _PDDF_FANUTIL_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _pddf_fanutil_completion -o default pddf_fanutil;
_pddf_fanutil_completion_setup() {
complete -o nosort -F _pddf_fanutil_completion pddf_fanutil
}

_pddf_fanutil_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/pddf_ledutil
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_pddf_ledutil_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_PDDF_LEDUTIL_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _PDDF_LEDUTIL_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _pddf_ledutil_completion -o default pddf_ledutil;
_pddf_ledutil_completion_setup() {
complete -o nosort -F _pddf_ledutil_completion pddf_ledutil
}

_pddf_ledutil_completion_setup;
28 changes: 24 additions & 4 deletions sonic-utilities-data/bash_completion.d/pddf_psuutil
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
_pddf_psuutil_completion() {
COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \
COMP_CWORD=$COMP_CWORD \
_PDDF_PSUUTIL_COMPLETE=complete $1 ) )
local IFS=$'\n'
local response

response=$(env COMP_WORDS="${COMP_WORDS[*]}" COMP_CWORD=$COMP_CWORD _PDDF_PSUUTIL_COMPLETE=bash_complete $1)

for completion in $response; do
IFS=',' read type value <<< "$completion"

if [[ $type == 'dir' ]]; then
COMPREPLY=()
compopt -o dirnames
elif [[ $type == 'file' ]]; then
COMPREPLY=()
compopt -o default
elif [[ $type == 'plain' ]]; then
COMPREPLY+=($value)
fi
done

return 0
}

complete -F _pddf_psuutil_completion -o default pddf_psuutil;
_pddf_psuutil_completion_setup() {
complete -o nosort -F _pddf_psuutil_completion pddf_psuutil
}

_pddf_psuutil_completion_setup;
Loading
Loading