mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:42:43 +00:00 
			
		
		
		
	Base: Add completion for cd that suggests only directories
This commit is contained in:
		
							parent
							
								
									785f95d0af
								
							
						
					
					
						commit
						66955b82a7
					
				
					 1 changed files with 14 additions and 0 deletions
				
			
		|  | @ -74,3 +74,17 @@ _complete_kill() { | |||
|     __complete_job_spec $*[-1] | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| _complete_cd() { | ||||
|     if test $*[-1] = '--' { | ||||
|         invariant_offset=0 | ||||
|         results=${concat_lists .*/ */} | ||||
|     } else { | ||||
|         invariant_offset=${length "$*[-1]"} | ||||
|         results=$(glob "$*[-1]*/") | ||||
|     } | ||||
| 
 | ||||
|     for $results { | ||||
|         echo '{"kind":"plain","static_offset":0,"invariant_offset":'"$invariant_offset"',"completion":"'"${remove_suffix / $it}"'","trailing_trivia":"/"}' | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Adam Harald Jørgensen
						Adam Harald Jørgensen