This file is indexed.

/usr/share/bash-completion/completions/lxc is in lxd-client 2.0.0-0ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
_have lxc && {
  _lxd_complete()
  {
    _lxd_names()
    {
      COMPREPLY=( $( compgen -W \
        "$( lxc list --fast | tail -n +4 | awk '{print $2}' | egrep -v '^(\||^$)' )" "$cur" )
      )
    }

    _lxd_images()
    {
      COMPREPLY=( $( compgen -W \
        "$( lxc image list | tail -n +4 | awk '{print $2}' | egrep -v '^(\||^$)' )" "$cur" )
      )
    }

    local cur prev

    COMPREPLY=()
    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}
    lxc_cmds="config copy delete exec file help image info init launch \
      list move profile publish remote restart restore snapshot start stop \
      version"

    if [ $COMP_CWORD -eq 1 ]; then
      COMPREPLY=( $(compgen -W "$lxc_cmds" -- $cur) )
    elif [ $COMP_CWORD -eq 2 ]; then
      case "$prev" in
        "config")
          COMPREPLY=( $(compgen -W "device edit get set show trust" -- $cur) )
          ;;
        "copy")
          _lxd_names
          ;;
        "delete")
          _lxd_names
          ;;
        "exec")
          _lxd_names
          ;;
        "file")
          COMPREPLY=( $(compgen -W "pull push edit" -- $cur) )
          ;;
        "help")
          COMPREPLY=( $(compgen -W "$lxc_cmds" -- $cur) )
          ;;
        "image")
          COMPREPLY=( $(compgen -W "import copy delete edit export info list show alias" -- $cur) )
          ;;
        "info")
          _lxd_names
          ;;
        "init")
          _lxd_images
          ;;
        "launch")
          _lxd_images
          ;;
        "move")
          _lxd_names
          ;;
        "profile")
          COMPREPLY=( $(compgen -W \
            "list show create edit copy get set delete apply device" -- $cur) )
          ;;
        "publish")
          _lxd_names
          ;;
        "remote")
          COMPREPLY=( $(compgen -W \
            "add remove list rename set-url set-default get-default" -- $cur) )
          ;;
        "restart")
          _lxd_names
          ;;
        "restore")
          _lxd_names
          ;;
        "snapshot")
          _lxd_names
          ;;
        "start")
          # should check if containers are stopped
          _lxd_names
          ;;
        "stop")
          # should check if containers are started
          _lxd_names
          ;;
        *)
          ;;
      esac
    fi

    return 0
  }

  complete -o default -F _lxd_complete lxc
}