# iscsiadm(1) completion -*- shell-script -*- proc _iscsiadm { var cur = '', prev = '', words = '', cword = '', split = '' _init_completion -s || return match $prev { with -m|--mode setglobal COMPREPLY = '( '$( compgen -W 'discovery node session iface fw host' \ -- "$cur" ) ) return 0 with -o|--op setglobal COMPREPLY = '( '$( compgen -W 'new delete update show' -- "$cur" ) ) return 0 with -t|--type setglobal COMPREPLY = '( '$( compgen -W 'sendtargets st slp isns fw' -- "$cur" ) ) return 0 with -L|-U|--loginall|--logoutall setglobal COMPREPLY = '( '$( compgen -W 'all manual automatic' -- "$cur" ) ) return 0 } $split && return 0 var options = '' if [[ $cword -gt 1 ]] { match $(words[2]) { with discovery set options = ''--help --version --debug --print --interface --type \ --portal --login --op --name --value'' with node set options = ''--help --version --debug --print --loginall \ --logoutall--show -T --portal --interface --login \ --logout --rescan --stats --op --name --value'' with session set options = ''--help --version --debug --print --sid --logout \ --rescan --stats'' with iface set options = ''--help --version --debug --print --interface --op \ --name --value'' with fw set options = ''--login'' with host set options = ''--print -H'' } } else { set options = ''--mode'' } setglobal COMPREPLY = '( '$( compgen -W "$options" -- "$cur" ) ) } && complete -F _iscsiadm iscsiadm # ex: ts=4 sw=4 et filetype=sh