<commit_before>#!/usr/bin/env bash
#
# Bash completion script for VBoxManage
#
# Copyright (c) 2012, <NAME> <<EMAIL>>
# Copyright (c) 2015, <NAME> <https://github.com/bgandon>
#

complete -F _vboxmanage 'vboxmanage'
complete -F _vboxmanage VBoxManage

# export VBOXMANAGE_NIC_TYPES

_vboxmanage() {
    local cur prev opts

    COMPREPLY=()

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

    # echo "cur: |$cur|"
    # echo "prev: |$prev|"

    case $prev in
        -v|--version)
            return 0
            ;;
        -l|--long)
            opts=$(__vboxmanage_list "long")
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        --nic[1-8])
            # This is part of modifyvm subcommand
            opts=$(__vboxmanage_nic_types)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            ;;
        startvm|unregistervm)
            opts=$(__vboxmanage_list-stopped-vms)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        list)
            opts=$(__vboxmanage_$prev)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        --type)
            COMPREPLY=($(compgen -W "gui headless" -- ${cur}))
            return 0
            ;;
        gui|headless)
            # Done. no more completion possible
            return 0
            ;;
        vboxmanage|VBoxManage)
            # In case current is complete command we return emmideatly.
            case $cur in
                startvm|list|controlvm|showvminfo|modifyvm)
                    COMPREPLY=($(compgen -W "$cur "))
                    return 0
                    ;;
            esac
            # Note: the default sed in OS X only supports \{1,\} and not \+
            opts="$(__vboxmanage_default)"
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        -q|--nologo)
            opts=$(__vboxmanage_default)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        controlvm|showvminfo|modifyvm)
            opts=$(__vboxmanage_list-all-vms)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        setlinkstate*|nictrace*|vrde|videocap)
            # vrde is a complete subcommand of controlvm
            opts="on off"
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        registervm)
            # It's quite hard to manage sapces in filenames and tilde exampansion
            # But the _filedir function in /etc/bash_completion does this for us.
            # On Debian: /usr/share/bash-completion/bash_completion
            # On OSX with Homebrew: /usr/local/etc/bash_completion
            #
            # See: <http://unix.stackexchange.com/a/77048>
            _filedir vbox
            return 0
            ;;
    esac

    if echo " $(__vboxmanage_list-all-vms) " | grep -Fq " $prev "; then
        VM="$prev"
        pprev=${COMP_WORDS[COMP_CWORD-2]}
        # echo "previous: $pprev"
        case $pprev in
            startvm)
                opts="--type"
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0
                ;;
            controlvm)
                opts=$(__vboxmanage_controlvm $VM)
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0;
                ;;
            showvminfo)
                opts="--details --machinereadable --log"
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0;
                ;;
            modifyvm)
                opts=$(__vboxmanage_modifyvm)
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0
                ;;
            unregistervm)
                opts="--delete"
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0
                ;;
        esac
    else
        echo "'$prev' not in '$(__vboxmanage_list-all-vms)'"
    fi

    # echo "Got to end withoug completion"
}

__vboxmanage_nic_types() {
    VBoxManage \
        | grep -F ' nic<' \
        | sed -e 's/.*nic<1-N> \([a-z\|]*\).*/\1/' \
        | tr '|' ' '
}
<commit_msg>Turned off intempestive debug message<commit_after>#!/usr/bin/env bash
#
# Bash completion script for VBoxManage
#
# Copyright (c) 2012, <NAME> <<EMAIL>>
# Copyright (c) 2015, <NAME> <https://github.com/bgandon>
#

complete -F _vboxmanage 'vboxmanage'
complete -F _vboxmanage VBoxManage

# export VBOXMANAGE_NIC_TYPES

_vboxmanage() {
    local cur prev opts

    COMPREPLY=()

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

    # echo "cur: |$cur|"
    # echo "prev: |$prev|"

    case $prev in
        -v|--version)
            return 0
            ;;
        -l|--long)
            opts=$(__vboxmanage_list "long")
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        --nic[1-8])
            # This is part of modifyvm subcommand
            opts=$(__vboxmanage_nic_types)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            ;;
        startvm|unregistervm)
            opts=$(__vboxmanage_list-stopped-vms)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        list)
            opts=$(__vboxmanage_$prev)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        --type)
            COMPREPLY=($(compgen -W "gui headless" -- ${cur}))
            return 0
            ;;
        gui|headless)
            # Done. no more completion possible
            return 0
            ;;
        vboxmanage|VBoxManage)
            # In case current is complete command we return emmideatly.
            case $cur in
                startvm|list|controlvm|showvminfo|modifyvm)
                    COMPREPLY=($(compgen -W "$cur "))
                    return 0
                    ;;
            esac
            # Note: the default sed in OS X only supports \{1,\} and not \+
            opts="$(__vboxmanage_default)"
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        -q|--nologo)
            opts=$(__vboxmanage_default)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        controlvm|showvminfo|modifyvm)
            opts=$(__vboxmanage_list-all-vms)
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        setlinkstate*|nictrace*|vrde|videocap)
            # vrde is a complete subcommand of controlvm
            opts="on off"
            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
            return 0
            ;;
        registervm)
            # It's quite hard to manage sapces in filenames and tilde exampansion
            # But the _filedir function in /etc/bash_completion does this for us.
            # On Debian: /usr/share/bash-completion/bash_completion
            # On OSX with Homebrew: /usr/local/etc/bash_completion
            #
            # See: <http://unix.stackexchange.com/a/77048>
            _filedir vbox
            return 0
            ;;
    esac

    if echo " $(__vboxmanage_list-all-vms) " | grep -Fq " $prev "; then
        VM="$prev"
        pprev=${COMP_WORDS[COMP_CWORD-2]}
        # echo "previous: $pprev"
        case $pprev in
            startvm)
                opts="--type"
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0
                ;;
            controlvm)
                opts=$(__vboxmanage_controlvm $VM)
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0;
                ;;
            showvminfo)
                opts="--details --machinereadable --log"
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0;
                ;;
            modifyvm)
                opts=$(__vboxmanage_modifyvm)
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0
                ;;
            unregistervm)
                opts="--delete"
                COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
                return 0
                ;;
        esac
    else
        # echo "'$prev' not in '$(__vboxmanage_list-all-vms)'"
    fi

    # echo "Got to end withoug completion"
}

__vboxmanage_nic_types() {
    VBoxManage \
        | grep -F ' nic<' \
        | sed -e 's/.*nic<1-N> \([a-z\|]*\).*/\1/' \
        | tr '|' ' '
}

{'fraction_non_alphanumeric': 0.14191988950276244, 'fraction_numerical': 0.008517495395948435, 'mean_word_length': 1.3766411378555798, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3071861', 'n_tokens_mistral': 2834, 'n_tokens_neox': 2643, 'n_words': 584}