Sha256: ea0062d4efa7a65186caf9963a9b67a0bad63934aa2c295edaf4f21d7ddb493e

Contents?: true

Size: 1.88 KB

Versions: 10

Compression:

Stored size: 1.88 KB

Contents

# Check for bash
[ -z "$BASH_VERSION" ] && return

####################################################################################################

__gsettings() {
  local choices

  case "${COMP_CWORD}" in
    1)
      choices=$'help \nlist-schemas\nlist-relocatable-schemas\nlist-keys \nlist-children \nlist-recursively \nget \nrange \nset \nreset \nwritable \nmonitor'
      ;;

    2)
      case "${COMP_WORDS[1]}" in
        help)
          choices=$'list-schemas\nlist-relocatable-schemas\nlist-keys\nlist-children\nlist-recursively\nget\nrange\nset\nreset\nwritable\nmonitor'
          ;;
        list-keys|list-children|list-recursively)
          choices="$(gsettings list-schemas)"$'\n'"$(gsettings list-relocatable-schemas | sed -e 's.$.:/.')"
          ;;

        get|range|set|reset|writable|monitor)
          choices="$(gsettings list-schemas | sed -e 's.$. .')"$'\n'"$(gsettings list-relocatable-schemas | sed -e 's.$.:/.')"
          ;;
      esac
      ;;

    3)
      case "${COMP_WORDS[1]}" in
        set)
          choices="$(gsettings list-keys ${COMP_WORDS[2]} 2> /dev/null | sed -e 's.$. .')"
          ;;

        get|range|reset|writable|monitor)
          choices="$(gsettings list-keys ${COMP_WORDS[2]} 2> /dev/null)"
          ;;
      esac
      ;;

    4)
      case "${COMP_WORDS[1]}" in
        set)
          range=($(gsettings range ${COMP_WORDS[2]} ${COMP_WORDS[3]} 2> /dev/null))
          case "${range[0]}" in
            enum)
              unset range[0]
             ;;
            *)
              unset range
             ;;
          esac
          local IFS=$'\n'
          choices="${range[*]}"
          ;;
      esac
      ;;
  esac

  local IFS=$'\n'
  COMPREPLY=($(compgen -W "${choices}" "${COMP_WORDS[$COMP_CWORD]}"))
}

####################################################################################################

complete -o nospace -F __gsettings gsettings

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
glib2-1.1.9-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.8-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.7-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.6-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.5-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.4-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.3-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.2-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.1-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh
glib2-1.1.0-x86-mingw32 vendor/local/etc/bash_completion.d/gsettings-bash-completion.sh