mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 06:30:27 +03:00 
			
		
		
		
	completion: set up _fdroid_* funcs at load time
This fixes an issue where these functions would not be created until fdroid was completed at least once.
This commit is contained in:
		
							parent
							
								
									f23011f408
								
							
						
					
					
						commit
						9eef437bca
					
				
					 1 changed files with 13 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -267,19 +267,22 @@ __complete_init() {
 | 
			
		|||
	__complete_options
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
_fdroid() {
 | 
			
		||||
	local cmd cmds
 | 
			
		||||
	cmd=${COMP_WORDS[1]}
 | 
			
		||||
	cmds=" build init install update publish checkupdates import \
 | 
			
		||||
readmeta rewritemeta lint scanner verify stats server signindex "
 | 
			
		||||
__cmds=" build init install update publish checkupdates import readmeta \
 | 
			
		||||
rewritemeta lint scanner verify stats server signindex "
 | 
			
		||||
 | 
			
		||||
	for c in $cmds; do eval "_fdroid_${c} () {
 | 
			
		||||
for c in $__cmds; do
 | 
			
		||||
	eval "_fdroid_${c} () {
 | 
			
		||||
		local cur prev opts lopts
 | 
			
		||||
		__fdroid_init ${c};
 | 
			
		||||
	}"; done
 | 
			
		||||
		__fdroid_init ${c}
 | 
			
		||||
	}"
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
	[[ $cmds == *\ $cmd\ * ]] && _fdroid_${cmd} || {
 | 
			
		||||
		(($COMP_CWORD == 1)) && COMPREPLY=( $( compgen -W "${cmds}" -- $cmd ) )
 | 
			
		||||
_fdroid() {
 | 
			
		||||
	local cmd
 | 
			
		||||
	cmd=${COMP_WORDS[1]}
 | 
			
		||||
 | 
			
		||||
	[[ $__cmds == *\ $cmd\ * ]] && _fdroid_${cmd} || {
 | 
			
		||||
		(($COMP_CWORD == 1)) && COMPREPLY=( $( compgen -W "${__cmds}" -- $cmd ) )
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue