Sha256: abdebf20e4a8c995ac489be15ea8f20a61b15159008bb38d52b863eacb61d73e

Contents?: true

Size: 1.5 KB

Versions: 6

Compression:

Stored size: 1.5 KB

Contents

_inspec() {
    local _inspec_top_level_commands="<%= top_level_commands.join(" ") %>"
    <% subcommands_with_commands.each do |name, subcommands| -%>
local _inspec_<%= name %>_commands="<%= subcommands.join(" ") -%>"
    <% end -%>

    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}

    if [ "$COMP_CWORD" -eq 1 ]; then
        case "$prev" in
            inspec)
                COMPREPLY=( $( compgen -W "$_inspec_top_level_commands" -- "$cur" ) )
                ;;
        esac
    elif [ "$COMP_CWORD" -eq 2 ]; then
        case "$prev" in
            archive|check|exec|json)
                COMPREPLY=( $( compgen -f -- "$cur" ) )
                ;;
            help)
                COMPREPLY=( $( compgen -W "$_inspec_top_level_commands" -- "$cur" ) )
                ;;
<% subcommands_with_commands.each do |name, subcommands| -%>
           <%= name %>)
                COMPREPLY=( $( compgen -W "$_inspec_<%= name %>_commands" -- "$cur" ) )
                ;;
<% end -%>
        esac
    elif [ "$COMP_CWORD" -eq 3 ]; then
        prev2=${COMP_WORDS[COMP_CWORD-2]}
        case "$prev2-$prev" in
            compliance-upload)
                COMPREPLY=( $( compgen -f -- "$cur" ) )
                ;;
<% subcommands_with_commands.each do |name, subcommands| -%>
           <%= name %>-help)
                COMPREPLY=( $( compgen -W "$_inspec_<%= name %>_commands" -- "$cur" ) )
                ;;
<% end -%>
        esac
    fi
}

complete -F _inspec inspec

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inspec-2.1.81 lib/inspec/completions/bash.sh.erb
inspec-2.1.21 lib/inspec/completions/bash.sh.erb
inspec-2.1.10 lib/inspec/completions/bash.sh.erb
inspec-2.0.32 lib/inspec/completions/bash.sh.erb
inspec-2.0.17 lib/inspec/completions/bash.sh.erb
inspec-1.51.15 lib/inspec/completions/bash.sh.erb