mirror of
				https://github.com/wting/autojump
				synced 2025-06-13 12:54:07 +00:00 
			
		
		
		
	Add --child support to autojump.
This commit is contained in:
		
							parent
							
								
									06e082c918
								
							
						
					
					
						commit
						971303bcde
					
				
							
								
								
									
										11
									
								
								bin/autojump
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								bin/autojump
									
									
									
									
									
								
							@ -120,6 +120,10 @@ def parse_arguments():
 | 
			
		||||
        '--complete', action='store_true', default=False,
 | 
			
		||||
        help='used for tab completion',
 | 
			
		||||
    )
 | 
			
		||||
    parser.add_argument(
 | 
			
		||||
        '--child', action="store_true", default=False,
 | 
			
		||||
        help='only match subdirectories of the current working directory'
 | 
			
		||||
    )
 | 
			
		||||
    parser.add_argument(
 | 
			
		||||
        '--purge', action='store_true', default=False,
 | 
			
		||||
        help='remove non-existent paths from database',
 | 
			
		||||
@ -313,6 +317,13 @@ def main(args):  # noqa
 | 
			
		||||
        tab_needle, tab_index, tab_path = \
 | 
			
		||||
            get_tab_entry_info(first(needles), TAB_SEPARATOR)
 | 
			
		||||
 | 
			
		||||
        if args.child:
 | 
			
		||||
            pwd = get_pwd()
 | 
			
		||||
            entries = ifilter(
 | 
			
		||||
                lambda entry: entry.path.find(pwd) == 0,
 | 
			
		||||
                entries
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        # Handle `j foo__`, assuming first index.
 | 
			
		||||
        if not tab_path and not tab_index \
 | 
			
		||||
                and tab_needle and needles[0] == tab_needle + TAB_SEPARATOR:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user