Add zsh support to auto-complete
This required the replacement of calls to _filedir in the script.
This commit is contained in:
parent
bb6693793f
commit
71d8a14a0d
|
@ -1,19 +1,37 @@
|
|||
# CBMC Autocomplete Scripts for Bash
|
||||
This directory contains an autocomplete script for bash.
|
||||
## Installation
|
||||
|
||||
## Installation for bash
|
||||
1. Compile cbmc and
|
||||
|
||||
2. `cd scripts/bash-autocomplete`
|
||||
|
||||
3. `./extract-switches.sh`
|
||||
|
||||
4. Put the following at the end of you in your `~/.bashrc`, with the directories adapted to your directory structure:
|
||||
4. Put the following at the end of your `~/.bashrc`, with the directories adapted to your directory structure:
|
||||
```bash
|
||||
cbmcautocomplete=~/diffblue/cbmc/scripts/bash-autocomplete/cbmc.sh
|
||||
if [ -f $cbmcautocomplete ]; then
|
||||
. $cbmcautocomplete
|
||||
fi
|
||||
```
|
||||
|
||||
5. `source ~/.bashrc`
|
||||
|
||||
## Installation for zsh
|
||||
Follow 1. 2. and 3. as above.
|
||||
|
||||
4. Put the following at the end of your `~/.zshrc`, with the directories adapted to your directory structure:
|
||||
```bash
|
||||
autoload bashcompinit
|
||||
bashcompinit
|
||||
cbmcautocomplete=~/diffblue/cbmc/scripts/bash-autocomplete/cbmc.sh
|
||||
if [ -f $cbmcautocomplete ]; then
|
||||
. $cbmcautocomplete
|
||||
fi
|
||||
```
|
||||
5. `source ~/.zshrc`
|
||||
|
||||
## Usage
|
||||
As with the usual autocomplete in bash, start typing a switch to complete it, for example:
|
||||
```
|
||||
|
|
|
@ -26,7 +26,7 @@ _cbmc_autocomplete()
|
|||
-I|--classpath|-cp|--outfile|--existing-coverage|--graphml-cex)
|
||||
#a switch that takes a file parameter of which we don't know an extension
|
||||
#TODO probably we can do more for -I, --classpath, -cp
|
||||
_filedir
|
||||
COMPREPLY=( $(compgen -f -- $cur) )
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
@ -38,6 +38,6 @@ _cbmc_autocomplete()
|
|||
fi
|
||||
|
||||
#if none of the above applies, offer directories and files that we can analyze
|
||||
_filedir "@(class|jar|cpp|cc|c\+\+|ii|cxx|c|i|gb)"
|
||||
COMPREPLY=( $(compgen -G '*.class|*.jar|*.cpp|*.cc|*.c\+\+|*.ii|*.cxx|*.c|*.i|*.gb' -- $cur) )
|
||||
}
|
||||
complete -F _cbmc_autocomplete cbmc
|
||||
|
|
Loading…
Reference in New Issue