added bash completion script
This commit is contained in:
		
					parent
					
						
							
								4e0edfb3fc
							
						
					
				
			
			
				commit
				
					
						cd29a8574f
					
				
			
		
					 2 changed files with 23 additions and 0 deletions
				
			
		
							
								
								
									
										20
									
								
								extras/completion/ctt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								extras/completion/ctt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,20 @@
 | 
			
		|||
_ctt() 
 | 
			
		||||
{
 | 
			
		||||
    local cur prev opts
 | 
			
		||||
    COMPREPLY=()
 | 
			
		||||
    cur="${COMP_WORDS[COMP_CWORD]}"
 | 
			
		||||
    prev="${COMP_WORDS[COMP_CWORD-1]}"
 | 
			
		||||
    comms="listproject track report"
 | 
			
		||||
    opts="-h --help -d --debug -v --verbose"
 | 
			
		||||
    cmdopts="--sd --start --ed --end -a --all -e --regexp -i --ignorecase -f --format"
 | 
			
		||||
    case "${prev}" in
 | 
			
		||||
        track|report)
 | 
			
		||||
            local projects=$(for p in ~/.ctt/*; do basename "$p"; done )
 | 
			
		||||
            COMPREPLY=( $(compgen -W "${projects} ${opts} ${cmdopts}" -- ${cur}) )
 | 
			
		||||
            return 0
 | 
			
		||||
        ;;
 | 
			
		||||
    esac
 | 
			
		||||
    COMPREPLY=( $(compgen -W "${comms} ${opts}" -- ${cur}) )
 | 
			
		||||
    return 0
 | 
			
		||||
}
 | 
			
		||||
complete -F _ctt ctt 
 | 
			
		||||
							
								
								
									
										3
									
								
								setup.py
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								setup.py
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -16,6 +16,9 @@ setup(name='ctt',
 | 
			
		|||
      packages=['lib/ctt',
 | 
			
		||||
                ],
 | 
			
		||||
      scripts=['scripts/ctt'],
 | 
			
		||||
      data_files=[
 | 
			
		||||
            ('/etc/bash_completion.d/', ['extras/completion/ctt']),
 | 
			
		||||
      ],
 | 
			
		||||
      zip_safe=True,
 | 
			
		||||
      classifiers=[
 | 
			
		||||
          'Environment :: Console',
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue