[ SYSTEM ]: Linux srv.persadacompanies.com 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
[ SERVER ]: Apache | PHP: 8.4.19
[ USER ]: persadamedika | IP: 45.64.1.108
GEFORCE FILE MANAGER
/
usr
/
share
/
bash-completion
/
completions
/
UPLOAD:
NAME
SIZE
QUICK PERMS
ACTIONS
📄 addpart
447 B
SET
[ EDIT ]
|
[ DEL ]
📄 blkdiscard
639 B
SET
[ EDIT ]
|
[ DEL ]
📄 blkid
2,094 B
SET
[ EDIT ]
|
[ DEL ]
📄 blkzone
971 B
SET
[ EDIT ]
|
[ DEL ]
📄 blockdev
726 B
SET
[ EDIT ]
|
[ DEL ]
📄 bootctl
1,937 B
SET
[ EDIT ]
|
[ DEL ]
📄 busctl
8,015 B
SET
[ EDIT ]
|
[ DEL ]
📄 bwrap
919 B
SET
[ EDIT ]
|
[ DEL ]
📄 cal
426 B
SET
[ EDIT ]
|
[ DEL ]
📄 cfdisk
546 B
SET
[ EDIT ]
|
[ DEL ]
📄 chcpu
1,510 B
SET
[ EDIT ]
|
[ DEL ]
📄 chfn
445 B
SET
[ EDIT ]
|
[ DEL ]
📄 chmem
501 B
SET
[ EDIT ]
|
[ DEL ]
📄 chrt
920 B
SET
[ EDIT ]
|
[ DEL ]
📄 chsh
504 B
SET
[ EDIT ]
|
[ DEL ]
📄 col
460 B
SET
[ EDIT ]
|
[ DEL ]
📄 colcrt
484 B
SET
[ EDIT ]
|
[ DEL ]
📄 colrm
509 B
SET
[ EDIT ]
|
[ DEL ]
📄 column
725 B
SET
[ EDIT ]
|
[ DEL ]
📄 coredumpctl
3,715 B
SET
[ EDIT ]
|
[ DEL ]
📄 cpupower
3,503 B
SET
[ EDIT ]
|
[ DEL ]
📄 ctrlaltdel
335 B
SET
[ EDIT ]
|
[ DEL ]
📄 delpart
526 B
SET
[ EDIT ]
|
[ DEL ]
📄 devlink
27,404 B
SET
[ EDIT ]
|
[ DEL ]
📄 dkms.bash-completion
2,673 B
SET
[ EDIT ]
|
[ DEL ]
📄 dmesg
1,182 B
SET
[ EDIT ]
|
[ DEL ]
📄 dnf
10,212 B
SET
[ EDIT ]
|
[ DEL ]
📄 dracut
3,580 B
SET
[ EDIT ]
|
[ DEL ]
📄 eject
1,189 B
SET
[ EDIT ]
|
[ DEL ]
📄 ethtool
24,075 B
SET
[ EDIT ]
|
[ DEL ]
📄 fallocate
721 B
SET
[ EDIT ]
|
[ DEL ]
📄 fdformat
566 B
SET
[ EDIT ]
|
[ DEL ]
📄 fdisk
1,834 B
SET
[ EDIT ]
|
[ DEL ]
📄 fincore
916 B
SET
[ EDIT ]
|
[ DEL ]
📄 findfs
695 B
SET
[ EDIT ]
|
[ DEL ]
📄 findmnt
3,154 B
SET
[ EDIT ]
|
[ DEL ]
📄 firewall-cmd
10,604 B
SET
[ EDIT ]
|
[ DEL ]
📄 flock
874 B
SET
[ EDIT ]
|
[ DEL ]
📄 fsck
787 B
SET
[ EDIT ]
|
[ DEL ]
📄 fsck.cramfs
684 B
SET
[ EDIT ]
|
[ DEL ]
📄 fsck.minix
383 B
SET
[ EDIT ]
|
[ DEL ]
📄 fsfreeze
524 B
SET
[ EDIT ]
|
[ DEL ]
📄 fstrim
677 B
SET
[ EDIT ]
|
[ DEL ]
📄 fwupdagent
610 B
SET
[ EDIT ]
|
[ DEL ]
📄 fwupdmgr
3,741 B
SET
[ EDIT ]
|
[ DEL ]
📄 fwupdtool
3,341 B
SET
[ EDIT ]
|
[ DEL ]
📄 gapplication
1,389 B
SET
[ EDIT ]
|
[ DEL ]
📄 gdbus
935 B
SET
[ EDIT ]
|
[ DEL ]
📄 getopt
815 B
SET
[ EDIT ]
|
[ DEL ]
📄 grub
11,681 B
SET
[ EDIT ]
|
[ DEL ]
📄 gsettings
2,829 B
SET
[ EDIT ]
|
[ DEL ]
📄 hexdump
1,007 B
SET
[ EDIT ]
|
[ DEL ]
📄 hostnamectl
2,281 B
SET
[ EDIT ]
|
[ DEL ]
📄 hwclock
938 B
SET
[ EDIT ]
|
[ DEL ]
📄 ionice
1,161 B
SET
[ EDIT ]
|
[ DEL ]
📄 ipcmk
576 B
SET
[ EDIT ]
|
[ DEL ]
📄 ipcrm
1,423 B
SET
[ EDIT ]
|
[ DEL ]
📄 ipcs
514 B
SET
[ EDIT ]
|
[ DEL ]
📄 isosize
529 B
SET
[ EDIT ]
|
[ DEL ]
📄 journalctl
5,892 B
SET
[ EDIT ]
|
[ DEL ]
📄 kernel-install
1,810 B
SET
[ EDIT ]
|
[ DEL ]
📄 kmod
3,235 B
SET
[ EDIT ]
|
[ DEL ]
📄 last
949 B
SET
[ EDIT ]
|
[ DEL ]
📄 ldattach
1,472 B
SET
[ EDIT ]
|
[ DEL ]
📄 localectl
3,739 B
SET
[ EDIT ]
|
[ DEL ]
📄 logger
1,553 B
SET
[ EDIT ]
|
[ DEL ]
📄 loginctl
4,251 B
SET
[ EDIT ]
|
[ DEL ]
📄 look
683 B
SET
[ EDIT ]
|
[ DEL ]
📄 losetup
1,721 B
SET
[ EDIT ]
|
[ DEL ]
📄 lsblk
1,961 B
SET
[ EDIT ]
|
[ DEL ]
📄 lscpu
1,018 B
SET
[ EDIT ]
|
[ DEL ]
📄 lsinitrd
1,983 B
SET
[ EDIT ]
|
[ DEL ]
📄 lsipc
1,310 B
SET
[ EDIT ]
|
[ DEL ]
📄 lslocks
1,069 B
SET
[ EDIT ]
|
[ DEL ]
📄 lslogins
1,704 B
SET
[ EDIT ]
|
[ DEL ]
📄 lsmem
1,054 B
SET
[ EDIT ]
|
[ DEL ]
📄 lsns
1,167 B
SET
[ EDIT ]
|
[ DEL ]
📄 mcookie
599 B
SET
[ EDIT ]
|
[ DEL ]
📄 mesg
412 B
SET
[ EDIT ]
|
[ DEL ]
📄 mkfs
638 B
SET
[ EDIT ]
|
[ DEL ]
📄 mkfs.cramfs
821 B
SET
[ EDIT ]
|
[ DEL ]
📄 mkfs.minix
714 B
SET
[ EDIT ]
|
[ DEL ]
📄 mkswap
841 B
SET
[ EDIT ]
|
[ DEL ]
📄 mokutil
1,177 B
SET
[ EDIT ]
|
[ DEL ]
📄 more
528 B
SET
[ EDIT ]
|
[ DEL ]
📄 mountpoint
487 B
SET
[ EDIT ]
|
[ DEL ]
📄 namei
500 B
SET
[ EDIT ]
|
[ DEL ]
📄 nmcli
3,841 B
SET
[ EDIT ]
|
[ DEL ]
📄 nsenter
1,171 B
SET
[ EDIT ]
|
[ DEL ]
📄 p11-kit
520 B
SET
[ EDIT ]
|
[ DEL ]
📄 partx
1,249 B
SET
[ EDIT ]
|
[ DEL ]
📄 pip3
286 B
SET
[ EDIT ]
|
[ DEL ]
📄 pivot_root
387 B
SET
[ EDIT ]
|
[ DEL ]
📄 portablectl
3,986 B
SET
[ EDIT ]
|
[ DEL ]
📄 prlimit
1,329 B
SET
[ EDIT ]
|
[ DEL ]
📄 raw
482 B
SET
[ EDIT ]
|
[ DEL ]
📄 readprofile
679 B
SET
[ EDIT ]
|
[ DEL ]
📄 rename
655 B
SET
[ EDIT ]
|
[ DEL ]
📄 renice
784 B
SET
[ EDIT ]
|
[ DEL ]
📄 resizepart
568 B
SET
[ EDIT ]
|
[ DEL ]
📄 resolvectl
7,066 B
SET
[ EDIT ]
|
[ DEL ]
📄 rev
432 B
SET
[ EDIT ]
|
[ DEL ]
📄 rfkill
929 B
SET
[ EDIT ]
|
[ DEL ]
📄 rtcwake
1,081 B
SET
[ EDIT ]
|
[ DEL ]
📄 runuser
864 B
SET
[ EDIT ]
|
[ DEL ]
📄 script
667 B
SET
[ EDIT ]
|
[ DEL ]
📄 scriptreplay
625 B
SET
[ EDIT ]
|
[ DEL ]
📄 semanage
6,570 B
SET
[ EDIT ]
|
[ DEL ]
📄 setarch
790 B
SET
[ EDIT ]
|
[ DEL ]
📄 setpriv
2,370 B
SET
[ EDIT ]
|
[ DEL ]
📄 setsebool
1,816 B
SET
[ EDIT ]
|
[ DEL ]
📄 setsid
440 B
SET
[ EDIT ]
|
[ DEL ]
📄 setterm
2,591 B
SET
[ EDIT ]
|
[ DEL ]
📄 sfdisk
2,012 B
SET
[ EDIT ]
|
[ DEL ]
📄 su
864 B
SET
[ EDIT ]
|
[ DEL ]
📄 swaplabel
635 B
SET
[ EDIT ]
|
[ DEL ]
📄 swapoff
743 B
SET
[ EDIT ]
|
[ DEL ]
📄 swapon
1,529 B
SET
[ EDIT ]
|
[ DEL ]
📄 syspurpose
720 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemctl
13,575 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-analyze
6,788 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-cat
1,911 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-cgls
2,344 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-cgtop
2,096 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-delta
1,951 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-detect-virt
1,361 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-path
1,901 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-resolve
3,189 B
SET
[ EDIT ]
|
[ DEL ]
📄 systemd-run
4,869 B
SET
[ EDIT ]
|
[ DEL ]
📄 taskset
1,207 B
SET
[ EDIT ]
|
[ DEL ]
📄 timedatectl
2,984 B
SET
[ EDIT ]
|
[ DEL ]
📄 trust
2,040 B
SET
[ EDIT ]
|
[ DEL ]
📄 tuned-adm
604 B
SET
[ EDIT ]
|
[ DEL ]
📄 udevadm
3,766 B
SET
[ EDIT ]
|
[ DEL ]
📄 ul
655 B
SET
[ EDIT ]
|
[ DEL ]
📄 unshare
809 B
SET
[ EDIT ]
|
[ DEL ]
📄 utmpdump
475 B
SET
[ EDIT ]
|
[ DEL ]
📄 uuidgen
657 B
SET
[ EDIT ]
|
[ DEL ]
📄 uuidparse
727 B
SET
[ EDIT ]
|
[ DEL ]
📄 wall
634 B
SET
[ EDIT ]
|
[ DEL ]
📄 wdctl
1,371 B
SET
[ EDIT ]
|
[ DEL ]
📄 whereis
535 B
SET
[ EDIT ]
|
[ DEL ]
📄 wipefs
1,192 B
SET
[ EDIT ]
|
[ DEL ]
📄 write
431 B
SET
[ EDIT ]
|
[ DEL ]
📄 zramctl
1,273 B
SET
[ EDIT ]
|
[ DEL ]
DELETE SELECTED
[ CLOSE ]
EDIT: devlink
# bash completion for devlink(8) -*- shell-script -*- # Get all the optional commands for devlink _devlink_get_optional_commands() { local object=$1; shift local filter_options="" local options="$(devlink $object help 2>&1 \ | command sed -n -e "s/^.*devlink $object //p" \ | cut -d " " -f 1)" # Remove duplicate options from "devlink $OBJECT help" command local opt for opt in $options; do if [[ $filter_options =~ $opt ]]; then continue else filter_options="$filter_options $opt" fi done echo $filter_options } # Complete based on given word, for when an argument or an option name has # but a few possible arguments. _devlink_direct_complete() { local dev port region value case $1 in dev) value=$(devlink dev show 2>/dev/null) ;; selftests_id) dev=${words[4]} value=$(devlink -j dev selftests show 2>/dev/null \ | jq ".selftests[\"$dev\"][]") ;; param_name) dev=${words[4]} value=$(devlink -j dev param show 2>/dev/null \ | jq ".param[\"$dev\"][].name") ;; port) value=$(devlink -j port show 2>/dev/null \ | jq '.port as $ports | $ports | keys[] as $key | ($ports[$key].netdev // $key)') ;; lc) dev=${words[3]} value=$(devlink -j lc show 2>/dev/null \ | jq ".lc[\"$dev\"]" \ | jq '. as $lcs | $lcs | keys[] as $key |($lcs[$key].lc)' \ 2>/dev/null) ;; lc_type) dev=${words[3]} lc=${words[5]} value=$(devlink lc show $dev lc $lc -j 2>/dev/null \ | jq '.[][][]["supported_types"][]') ;; region) value=$(devlink -j region show 2>/dev/null \ | jq '.regions' | jq 'keys[]') ;; snapshot) region=${words[3]} value=$(devlink -j region show 2>/dev/null \ | jq ".regions[\"$region\"].snapshot[]") ;; trap) dev=${words[3]} value=$(devlink -j trap show 2>/dev/null \ | jq ".trap[\"$dev\"][].name") ;; trap_group) dev=${words[4]} value=$(devlink -j trap group show 2>/dev/null \ | jq ".trap_group[\"$dev\"][].name") ;; trap_policer) dev=${words[4]} value=$(devlink -j trap policer show 2>/dev/null \ | jq ".trap_policer[\"$dev\"][].policer") ;; health_dev) value=$(devlink -j health show 2>/dev/null | jq '.health' \ | jq 'keys[]') ;; reporter) dev=${words[cword - 2]} value=$(devlink -j health show 2>/dev/null \ | jq ".health[\"$dev\"][].reporter") ;; pool) dev=$pprev value=$(devlink -j sb pool show 2>/dev/null \ | jq ".pool[\"$dev\"][].pool") ;; port_pool) port=${words[5]} value=$(devlink -j sb port pool show 2>/dev/null \ | jq ".port_pool[\"$port\"][].pool") ;; tc) port=$pprev value=$(devlink -j sb tc bind show 2>/dev/null \ | jq ".tc_bind[\"$port\"][].tc") ;; esac COMPREPLY+=( $( compgen -W "$value" -- "$cur" ) ) # Remove colon containing prefix from COMPREPLY items in order to avoid # wordbreaks with colon. __ltrim_colon_completions "$cur" } # Completion for devlink dev eswitch set _devlink_dev_eswitch_set() { local -A settings=( [mode]=notseen [inline-mode]=notseen [encap-mode]=notseen ) if [[ $cword -eq 5 ]]; then COMPREPLY=( $( compgen -W "mode inline-mode encap-mode" -- "$cur" ) ) fi # Mark seen settings local word for word in "${words[@]:5:${#words[@]}-1}"; do if [[ -n $word ]]; then if [[ "${settings[$word]}" ]]; then settings[$word]=seen fi fi done case $prev in mode) COMPREPLY=( $( compgen -W "legacy switchdev" -- "$cur" ) ) return ;; inline-mode) COMPREPLY=( $( compgen -W "none link network transport" -- \ "$cur" ) ) return ;; encap-mode) COMPREPLY=( $( compgen -W "none basic" -- "$cur" ) ) return ;; esac local -a comp_words=() # Add settings not seen to completions local setting for setting in "${!settings[@]}"; do if [ "${settings[$setting]}" = notseen ]; then comp_words+=( "$setting" ) fi done COMPREPLY=( $( compgen -W "${comp_words[*]}" -- "$cur" ) ) } # Completion for devlink dev eswitch _devlink_dev_eswitch() { case "$cword" in 3) COMPREPLY=( $( compgen -W "show set" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; esac case "${words[3]}" in set) _devlink_dev_eswitch_set return ;; show) return ;; esac } # Completion for devlink dev param set _devlink_dev_param_set() { case $cword in 7) COMPREPLY=( $( compgen -W "value" -- "$cur" ) ) return ;; 8) # String argument return ;; 9) COMPREPLY=( $( compgen -W "cmode" -- "$cur" ) ) return ;; 10) COMPREPLY=( $( compgen -W "runtime driverinit permanent" -- \ "$cur" ) ) return ;; esac } # Completion for devlink dev param _devlink_dev_param() { case "$cword" in 3) COMPREPLY=( $( compgen -W "show set" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; 5) COMPREPLY=( $( compgen -W "name" -- "$cur" ) ) return ;; 6) _devlink_direct_complete "param_name" return ;; esac if [[ "${words[3]}" == "set" ]]; then _devlink_dev_param_set fi } # Completion for devlink dev reload _devlink_dev_reload() { case "$cword" in 4) COMPREPLY=( $( compgen -W "netns" -- "$cur" ) ) return ;; 5) local nslist=$( ip netns list 2>/dev/null ) COMPREPLY=( $( compgen -W "$nslist" -- "$cur" ) ) return ;; esac } # Completion for devlink dev flash _devlink_dev_flash() { case "$cword" in 4) COMPREPLY=( $( compgen -W "file" -- "$cur" ) ) return ;; 5) _filedir return ;; 6) COMPREPLY=( $( compgen -W "component" -- "$cur" ) ) return ;; esac } # Completion for devlink dev selftests _devlink_dev_selftests() { if [[ $cword -gt 5 ]]; then _devlink_direct_complete "selftests_id" return fi case "$cword" in 3) COMPREPLY=( $( compgen -W "show run" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; 5) COMPREPLY=( $( compgen -W "id" -- "$cur" ) ) return ;; esac } # Completion for devlink dev _devlink_dev() { case $command in show|reload|info|flash) if [[ $cword -le 3 ]]; then _devlink_direct_complete "dev" elif [[ $command == "reload" || $command == "flash" ]];then _devlink_dev_$command fi return ;; eswitch|param|selftests) _devlink_dev_$command return ;; esac } # Completion for devlink port set _devlink_port_set() { case "$cword" in 3) _devlink_direct_complete "port" return ;; 4) COMPREPLY=( $( compgen -W "type" -- "$cur" ) ) return ;; 5) COMPREPLY=( $( compgen -W "eth ib auto" -- "$cur" ) ) return ;; esac } # Completion for devlink port split _devlink_port_split() { case "$cword" in 3) _devlink_direct_complete "port" return ;; 4) COMPREPLY=( $( compgen -W "count" -- "$cur" ) ) return ;; 5) # Integer argument return ;; esac } # Completion for devlink port param set _devlink_port_param_set() { case $cword in 7) COMPREPLY=( $( compgen -W "value" -- "$cur" ) ) return ;; 8) # String argument return ;; 9) COMPREPLY=( $( compgen -W "cmode" -- "$cur" ) ) return ;; 10) COMPREPLY=( $( compgen -W "runtime driverinit permanent" -- \ "$cur" ) ) return ;; esac } # Completion for devlink port param _devlink_port_param() { case "$cword" in 3) COMPREPLY=( $( compgen -W "show set" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "port" return ;; 5) COMPREPLY=( $( compgen -W "name" -- "$cur" ) ) return ;; 6) _devlink_direct_complete "param_name" return ;; esac if [[ "${words[3]}" == "set" ]]; then _devlink_port_param_set fi } # Completion for devlink port _devlink_port() { case $command in set) _devlink_port_set return ;; split) _devlink_port_split return ;; param) _devlink_port_param return ;; show|unsplit) if [[ $cword -eq 3 ]]; then _devlink_direct_complete "port" fi return ;; esac } # Completion for devlink lc set _devlink_lc_set() { case "$cword" in 3) _devlink_direct_complete "dev" return ;; 4) COMPREPLY=( $( compgen -W "lc" -- "$cur" ) ) ;; 5) _devlink_direct_complete "lc" ;; 6) COMPREPLY=( $( compgen -W "type notype" -- "$cur" ) ) return ;; 7) if [[ "$prev" == "type" ]]; then _devlink_direct_complete "lc_type" fi esac } # Completion for devlink lc show _devlink_lc_show() { case $cword in 3) _devlink_direct_complete "dev" ;; 4) COMPREPLY=( $( compgen -W "lc" -- "$cur" ) ) ;; 5) _devlink_direct_complete "lc" ;; esac } # Completion for devlink lc _devlink_lc() { case $command in set) _devlink_lc_set return ;; show) _devlink_lc_show return ;; esac } # Completion for devlink dpipe _devlink_dpipe() { local options="$(devlink dpipe help 2>&1 \ | command sed -e '/OBJECT-LIST := /!d' \ -e 's/.*{ //' -e 's/}.*//' -e 's/|//g' )" if [[ $cword -eq 2 ]]; then COMPREPLY+=( $( compgen -W "$options" -- "$cur" ) ) fi } # Completion for devlink monitor _devlink_monitor() { local options="$(devlink monitor help 2>&1 \ | command sed -e '/OBJECT-LIST := /!d' \ -e 's/.*{ //' -e 's/}.*//' -e 's/|//g' )" if [[ $cword -eq 2 ]]; then COMPREPLY+=( $( compgen -W "all $options" -- "$cur" ) ) fi } # Completion for the rest of devlink sb $command _devlink_sb_command_options() { local subcmd case $command in pool) subcmd=${words[3]} if [[ $cword -eq 5 ]]; then COMPREPLY=( $( compgen -W "pool" -- "$cur" ) ) fi if [[ $subcmd == "set" ]]; then case $cword in 7) COMPREPLY+=( $( compgen -W "size" -- "$cur" ) ) ;; 9) COMPREPLY+=( $( compgen -W "thtype" -- "$cur" ) ) ;; esac fi ;; port) subcmd=${words[4]} if [[ $cword -eq 6 ]]; then COMPREPLY+=( $( compgen -W "pool" -- "$cur" ) ) fi if [[ $subcmd == "set" ]]; then case $cword in 8) COMPREPLY+=( $( compgen -W "th" -- "$cur" ) ) ;; esac fi ;; tc) subcmd=${words[4]} case $cword in 6) COMPREPLY+=( $( compgen -W "tc" -- "$cur" ) ) ;; 8) COMPREPLY+=( $( compgen -W "type" -- "$cur" ) ) ;; esac if [[ $subcmd == "set" ]]; then case $cword in 10) COMPREPLY+=( $( compgen -W "pool" -- "$cur" ) ) ;; 12) COMPREPLY+=( $( compgen -W "th" -- "$cur" ) ) ;; esac fi ;; esac } # Completion for devlink sb _devlink_sb() { case $prev in bind) COMPREPLY=( $( compgen -W "set show" -- "$cur" ) ) ;; occupancy) COMPREPLY=( $( compgen -W "show snapshot clearmax" -- "$cur" ) ) ;; pool) if [[ $cword -eq 3 || $cword -eq 4 ]]; then COMPREPLY=( $( compgen -W "set show" -- "$cur" ) ) elif [[ $command == "port" || $command == "tc" ]]; then _devlink_direct_complete "port_pool" else _devlink_direct_complete "pool" fi ;; port) if [[ $cword -eq 3 ]]; then COMPREPLY=( $( compgen -W "pool" -- "$cur" ) ) fi ;; show|set|snapshot|clearmax) case $command in show|pool|occupancy) _devlink_direct_complete "dev" if [[ $command == "occupancy" && $prev == "show" ]];then _devlink_direct_complete "port" fi ;; port|tc) _devlink_direct_complete "port" ;; esac ;; size) # Integer argument ;; thtype) COMPREPLY=( $( compgen -W "static dynamic" -- "$cur" ) ) ;; th) # Integer argument ;; tc) if [[ $cword -eq 3 ]]; then COMPREPLY=( $( compgen -W "bind" -- "$cur" ) ) else _devlink_direct_complete "tc" fi ;; type) COMPREPLY=( $( compgen -W "ingress egress" -- "$cur" ) ) ;; esac _devlink_sb_command_options return } # Completion for devlink resource set path argument _devlink_resource_path() { local path parents parent all_path local dev=${words[3]} local -a path local all_path=$( devlink resource show $dev \ | sed -E '# Of resource lines, keep only the name itself. s/name ([^ ]*) .*/\1/ # Drop headers. /:$/d # First layer is not aligned enough, align it. s/^/ / # Use slashes as unary code for resource depth. s, ,/,g # Separate tally count from resource name. s,/*,&\t,' \ | while read d name; do while ((${#path[@]} > ${#d})); do unset path[$((${#path[@]} - 1))] done path[$((${#d} - 1))]=$name echo ${path[@]} done \ | sed '# Convert paths to slash-separated s,^,/,;s, ,/,g;s,$,/,' ) COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "$all_path" -- "$cur" ) ) } # Completion for devlink resource set _devlink_resource_set() { case "$cword" in 3) _devlink_direct_complete "dev" return ;; 4) COMPREPLY=( $( compgen -W "path" -- "$cur" ) ) return ;; 5) _devlink_resource_path return ;; 6) COMPREPLY=( $( compgen -W "size" -- "$cur" ) ) return ;; 7) # Integer argument return ;; esac } # Completion for devlink resource _devlink_resource() { case $command in show) if [[ $cword -eq 3 ]]; then _devlink_direct_complete "dev" fi return ;; set) _devlink_resource_set return ;; esac } # Completion for devlink region read _devlink_region_read() { case "$cword" in 6) COMPREPLY=( $( compgen -W "address" -- "$cur" ) ) return ;; 7) # Address argument, for example: 0x10 return ;; 8) COMPREPLY=( $( compgen -W "length" -- "$cur" ) ) return ;; 9) # Integer argument return ;; esac } # Completion for devlink region _devlink_region() { if [[ $cword -eq 3 && $command != "help" ]]; then _devlink_direct_complete "region" fi case $command in show) return ;; del|dump|read) case "$cword" in 4) COMPREPLY=( $( compgen -W "snapshot" -- "$cur" ) ) ;; 5) _devlink_direct_complete "snapshot" ;; esac if [[ $command == "read" ]]; then _devlink_region_read fi return ;; esac } # Completion reporter for devlink health _devlink_health_reporter() { local i=$1; shift case $cword in $((3 + $i))) _devlink_direct_complete "health_dev" ;; $((4 + $i))) COMPREPLY=( $( compgen -W "reporter" -- "$cur" ) ) ;; $((5 + $i))) _devlink_direct_complete "reporter" ;; esac } # Completion for devlink health _devlink_health() { case $command in show|recover|diagnose|set|test) _devlink_health_reporter 0 if [[ $command == "set" ]]; then case $cword in 6) COMPREPLY=( $( compgen -W "grace_period auto_recover" \ -- "$cur" ) ) ;; 7) case $prev in grace_period) # Integer argument- msec ;; auto_recover) COMPREPLY=( $( compgen -W "true false" -- \ "$cur" ) ) ;; esac esac fi return ;; dump) if [[ $cword -eq 3 ]]; then COMPREPLY=( $( compgen -W "show clear" -- "$cur" ) ) fi _devlink_health_reporter 1 return ;; esac } # Completion for action in devlink trap set _devlink_trap_set_action() { local i=$1; shift case $cword in $((6 + $i))) COMPREPLY=( $( compgen -W "action" -- "$cur" ) ) ;; $((7 + $i))) COMPREPLY=( $( compgen -W "trap drop mirror" -- "$cur" ) ) ;; esac } # Completion for devlink trap group set _devlink_trap_group_set() { local -A settings=( [action]=notseen [policer]=notseen [nopolicer]=notseen ) if [[ $cword -eq 7 ]]; then COMPREPLY=( $( compgen -W "action policer nopolicer" -- "$cur" ) ) fi # Mark seen settings local word for word in "${words[@]:7:${#words[@]}-1}"; do if [[ -n $word ]]; then if [[ "${settings[$word]}" ]]; then settings[$word]=seen fi fi done case $prev in action) COMPREPLY=( $( compgen -W "trap drop mirror" -- "$cur" ) ) return ;; policer) _devlink_direct_complete "trap_policer" return ;; esac local -a comp_words=() # Add settings not seen to completions local setting for setting in "${!settings[@]}"; do if [ "${settings[$setting]}" = notseen ]; then comp_words+=( "$setting" ) fi done COMPREPLY=( $( compgen -W "${comp_words[*]}" -- "$cur" ) ) } # Completion for devlink trap group _devlink_trap_group() { case $cword in 3) COMPREPLY=( $( compgen -W "set show" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; 5) COMPREPLY=( $( compgen -W "group" -- "$cur" ) ) return ;; 6) _devlink_direct_complete "trap_group" return ;; esac if [[ ${words[3]} == "set" ]]; then _devlink_trap_group_set fi } # Completion for devlink trap policer set _devlink_trap_policer_set() { local -A settings=( [rate]=notseen [burst]=notseen ) if [[ $cword -eq 7 ]]; then COMPREPLY=( $( compgen -W "rate burst" -- "$cur" ) ) fi # Mark seen settings local word for word in "${words[@]:7:${#words[@]}-1}"; do if [[ -n $word ]]; then if [[ "${settings[$word]}" ]]; then settings[$word]=seen fi fi done case $prev in rate) # Integer argument return ;; burst) # Integer argument return ;; esac local -a comp_words=() # Add settings not seen to completions local setting for setting in "${!settings[@]}"; do if [ "${settings[$setting]}" = notseen ]; then comp_words+=( "$setting" ) fi done COMPREPLY=( $( compgen -W "${comp_words[*]}" -- "$cur" ) ) } # Completion for devlink trap policer _devlink_trap_policer() { case $cword in 3) COMPREPLY=( $( compgen -W "set show" -- "$cur" ) ) return ;; 4) _devlink_direct_complete "dev" return ;; 5) COMPREPLY=( $( compgen -W "policer" -- "$cur" ) ) return ;; 6) _devlink_direct_complete "trap_policer" return ;; esac if [[ ${words[3]} == "set" ]]; then _devlink_trap_policer_set fi } # Completion for devlink trap _devlink_trap() { case $command in show|set) case $cword in 3) _devlink_direct_complete "dev" ;; 4) COMPREPLY=( $( compgen -W "trap" -- "$cur" ) ) ;; 5) _devlink_direct_complete "trap" ;; esac if [[ $command == "set" ]]; then _devlink_trap_set_action 0 fi return ;; group) _devlink_trap_$command return ;; policer) _devlink_trap_$command return ;; esac } # Complete any devlink command _devlink() { local cur prev words cword local opt='--Version --no-nice-names --json --pretty --verbose \ --statistics --force --Netns --batch' local objects="$(devlink help 2>&1 | command sed -e '/OBJECT := /!d' \ -e 's/.*{//' -e 's/}.*//' -e \ 's/|//g' )" _init_completion || return # Gets the word-to-complete without considering the colon as word breaks _get_comp_words_by_ref -n : cur prev words cword if [[ $cword -eq 1 ]]; then case $cur in -*) COMPREPLY=( $( compgen -W "$opt" -- "$cur" ) ) return 0 ;; *) COMPREPLY=( $( compgen -W "$objects" -- "$cur" ) ) return 0 ;; esac fi # Deal with options if [[ $prev == -* ]]; then case $prev in -V|--Version) return 0 ;; -b|--batch) _filedir return 0 ;; --force) COMPREPLY=( $( compgen -W "--batch" -- "$cur" ) ) return 0 ;; -N|--Netns) local nslist=$( ip netns list 2>/dev/null ) COMPREPLY=( $( compgen -W "$nslist" -- "$cur" ) ) return 0 ;; -j|--json) COMPREPLY=( $( compgen -W "--pretty $objects" -- "$cur" ) ) return 0 ;; *) COMPREPLY=( $( compgen -W "$objects" -- "$cur" ) ) return 0 ;; esac fi # Remove all options so completions don't have to deal with them. local i for (( i=1; i < ${#words[@]}; )); do if [[ ${words[i]::1} == - ]]; then words=( "${words[@]:0:i}" "${words[@]:i+1}" ) [[ $i -le $cword ]] && cword=$(( cword - 1 )) else i=$(( ++i )) fi done local object=${words[1]} local command=${words[2]} local pprev=${words[cword - 2]} local prev=${words[cword - 1]} if [[ $objects =~ $object ]]; then if [[ $cword -eq 2 ]]; then COMPREPLY=( $( compgen -W "help" -- "$cur") ) if [[ $object != "monitor" && $object != "dpipe" ]]; then COMPREPLY+=( $( compgen -W \ "$(_devlink_get_optional_commands $object)" -- "$cur" ) ) fi fi "_devlink_$object" fi } && complete -F _devlink devlink # ex: ts=4 sw=4 et filetype=sh