Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash completion for pacreport #58

Open
sol opened this issue Mar 4, 2022 · 1 comment
Open

Bash completion for pacreport #58

sol opened this issue Mar 4, 2022 · 1 comment

Comments

@sol
Copy link

sol commented Mar 4, 2022

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
@VorpalBlade
Copy link

This is related to pull request #55 (which adds zsh completion for all the commands).
Issue #57 also covers point 2 of the documentation mismatch, though point 1 should be added to it.

Unfortunately it seems this repo is not maintained any more (nothing has happened for some time).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants