Skip to content

Bash completion for pacreport#58

Description

@sol

Hey there 馃憢

I wrote a bash completion script for pacreport. Please feel free to add it to the repo.

BTW: In the process I noticed two minor issues with the docs:

  1. The man pages erroneously document the --cachedir option as --cache-dir.
  2. --optional-deps is only documented in the man pages, but omitted from the --help output.
# This file is in the public domain.

_pacreport() {
  local cur prev words cword
  _init_completion || return

  local opts='--config --dbext --dbpath --root --sysroot --cachedir --backups --group --missing-files --unowned-files --optional-deps --help --version'

  case "${prev}" in

    # requires file argument
    --config)
      _filedir
      return 0
      ;;

    # requires directory argument
    --root|--sysroot|--cachedir|--dbpath)
      _filedir -d
      return 0
      ;;

    # requires group argument
    --group)
      COMPREPLY=( $(compgen -W "$(pacman -Sgq)" -- ${cur}) )
      return 0
      ;;

    # requires some argument
    --dbext)
      return 0
      ;;

    *)
      COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
      ;;
  esac
}

complete -F _pacreport pacreport

# vim: et:ts=2:sw=2:ft=bash

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions