]> git.donarmstrong.com Git - deb_pkgs/autorandr.git/commit
Work around problems with autorandr's completion when using `bashcompinit`
authorMaximilian Bosch <maximilian@mbosch.me>
Thu, 21 Mar 2019 23:49:42 +0000 (00:49 +0100)
committerMaximilian Bosch <maximilian@mbosch.me>
Thu, 21 Mar 2019 23:49:42 +0000 (00:49 +0100)
commitd38e22e5064d448099d1925cce16593a327c7d74
treeaba9fc50b0ed74c47bdfc4ba951e10313ebae173
parent7fda58e351b52f2245c97f5d06685e3b9ab06363
Work around problems with autorandr's completion when using `bashcompinit`

On ZSH the easiest approach to get bash completions running is to use
`bashcompinit`. Unfortunately it seems as there are slight differences
between ZSH and bash which cause problems when using that feature.

I had to change the following things:

* Replace the `-n` check with a length check of the AR directory array:
  ZSH adds an empty string at first if no system directory for autorandr
  was found. Checking if there's at least a single element works around
  this problem.

* Silence errors from `find`. The empty string at first causes a
  `directory not found error` during the completion.

It can be tested on ZSH after running the following command:

```
$ autoload -U +X bashcompinit && bashcompinit && source ./contrib/bash_completion/autorandr
```

Tested with zsh 5.7.1 (x86_64-pc-linux-gnu).
contrib/bash_completion/autorandr