mirror of
				git://git.code.sf.net/p/zsh/code
				synced 2025-10-31 18:10:56 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
	
		
			753 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			753 B
		
	
	
	
		
			Text
		
	
	
	
	
	
| #autoload
 | |
| 
 | |
| # Utility function for completing files of a given type or any file.
 | |
| # In many cases you will want to call this one instead of _path_files().
 | |
| 
 | |
| local nm=$NMATCHES
 | |
| 
 | |
| _path_files "$@"
 | |
| 
 | |
| if [[ $# -ne 0 && -nmatches nm ]]; then
 | |
|   local opt opts
 | |
| 
 | |
|   # We didn't get any matches for those types of files described by
 | |
|   # the `-g' or `-/' option. Now we try it again accepting all files.
 | |
|   # First we get those options that we have to use even if then. If
 | |
|   # we find out that the `-f' option was given, we already accepted
 | |
|   # all files and give up immediatly.
 | |
| 
 | |
|   opts=()
 | |
|   while getopts "P:S:W:F:J:V:X:f/g:" opt; do
 | |
|     [[ "$opt" = f ]] && return
 | |
|     [[ "$opt" = [PSWFJVX] ]] && opts=("$opts[@]" "-$opt" "$OPTARG")
 | |
|   done
 | |
| 
 | |
|   _path_files "$opts[@]"
 | |
| fi
 |