Changeset 225


Ignore:
Timestamp:
Jun 19, 2018, 6:16:08 PM (2 years ago)
Author:
g7moreau
Message:
  • Update bash completion
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ddt/ddt.bash_completion

    r221 r225  
    1 # bash completion for dhcp-dns-tools
     1# bash completion for ddt
    22
    3 have dhcp-dns-tools &&
    4 _dhcp_dns_tools() {
     3have ddt &&
     4_ddt() {
    55   local cur prev
    66
     
    1212   case $prev in
    1313      -b|--bootp)
    14          local showlist=$(dhcp-dns-tools show-pxe --no-header|awk '{print $1}')
     14         local showlist=$(ddt show-pxe --no-header|awk '{print $1}')
    1515         COMPREPLY=($(compgen -W "${showlist}" -- "$cur"))
    1616         return 0
    1717         ;;
    1818      -d|--domainset)
    19          local showlist=$(dhcp-dns-tools show-domainset --no-header|awk '{print $1}')
     19         local showlist=$(ddt show-domainset --no-header|awk '{print $1}')
    2020         COMPREPLY=($(compgen -W "${showlist}" -- "$cur"))
    2121         return 0
    2222         ;;
    2323      -p|--pool)
    24          local showlist=$(dhcp-dns-tools show-pool --no-header|awk '{print $1}')
     24         local showlist=$(ddt show-pool --no-header|awk '{print $1}')
    2525         COMPREPLY=($(compgen -W "${showlist}" -- "$cur"))
    2626         return 0
     
    3131         ;;
    3232      -t|--tag)
    33          local showlist=$(dhcp-dns-tools show-tag --no-header|awk '{print $1}')
     33         local showlist=$(ddt show-tag --no-header|awk '{print $1}')
    3434         COMPREPLY=($(compgen -W "${showlist}" -- "$cur"))
    3535         return 0
     
    3939   if [[ "$cur" == '-*' || $COMP_CWORD -gt 1 ]]
    4040   then
    41       COMPREPLY=($(compgen -W "$(dhcp-dns-tools help|grep "^ dhcp-dns-tools ${COMP_WORDS[1]}"|sed -e 's/[\[]/\n/g;'|grep -- '^-'|cut -f 1 -d ']'|cut -f 1 -d ' '|sed -e 's/|/ /g;'|xargs echo -n)" -- "$cur"))
     41      COMPREPLY=($(compgen -W "$(ddt help|grep "^ ddt ${COMP_WORDS[1]}"|sed -e 's/[\[]/\n/g;'|grep -- '^-'|cut -f 1 -d ']'|cut -f 1 -d ' '|sed -e 's/|/ /g;'|xargs echo -n)" -- "$cur"))
    4242   else
    43       COMPREPLY=($(compgen -W "$($(which dhcp-dns-tools||echo /usr/local/bin/dhcp-dns-tools) help|grep '^ dhcp-dns-tools'|awk '{print $2}'|xargs echo -n)" -- "$cur"))
     43      COMPREPLY=($(compgen -W "$($(which ddt||echo /usr/local/bin/ddt) help|grep '^ ddt'|awk '{print $2}'|xargs echo -n)" -- "$cur"))
    4444   fi
    4545
    46 #   if [[ "$cur" == -* ]]; then
    47 #      COMPREPLY=( $( compgen -W '-h -d -i -p -m -c' -- "$cur" ) )
    48 #   else
    49 #      COMPREPLY=( $( compgen -W 'add_alias add_dhcp add_float add_static add_virtual \
    50 #         create_pool \
    51 #         change_mac change_ip change_host change_comment change_tag change_domainset \
    52 #         del_pc del_float \
    53 #         disable_pc disable_float enable_pc enable_float \
    54 #         gen_dhcp_file gen_dns_file check_dns \
    55 #         load_database \
    56 #         create_domainset show_domainset \
    57 #         create_pxe remove_pxe show_pxe enable_pxe disable_pxe \
    58 #         create_tag remove_tag show_tag \
    59 #         show search_mac \
    60 #         help' -- "$cur" ) )
    61 #   fi
    62 
    63    } && complete -F _dhcp_dns_tools dhcp-dns-tools
     46   } && complete -F _dhcp_dns_tools ddt
Note: See TracChangeset for help on using the changeset viewer.