mirror of
				https://github.com/ohwgiles/laminar.git
				synced 2025-06-13 12:54:29 +00:00 
			
		
		
		
	Add completion scripts for laminarc in zsh and bash
This commit is contained in:
		
							parent
							
								
									77b8c8d601
								
							
						
					
					
						commit
						fab5cef0ca
					
				
							
								
								
									
										28
									
								
								laminarc-completion.bash
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								laminarc-completion.bash
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | ||||
| # Bash completion file for laminarc | ||||
| # vim: ft=sh | ||||
| 
 | ||||
| _laminarc() { | ||||
| 	local cur prev words cword | ||||
| 	_init_completion || return | ||||
| 	if [ "$cword" -gt 1 ]; then | ||||
| 		case "${words[1]}" in | ||||
| 			queue|start|run) | ||||
| 				if [ "$cword" -eq 2 ]; then | ||||
| 					COMPREPLY+=($(compgen -W "$(laminarc show-jobs)" -- ${cur})) | ||||
| 				fi | ||||
| 				;; | ||||
| 			abort) | ||||
| 				if [ "$cword" -eq 2 ]; then | ||||
| 					COMPREPLY+=($(compgen -W "$(laminarc show-running | cut -d : -f 1)" -- ${cur})) | ||||
| 				elif [ "$cword" -eq 3 ]; then | ||||
| 					COMPREPLY+=($(compgen -W "$(laminarc show-running | cut -d : -f 2)" -- ${cur})) | ||||
| 				fi | ||||
| 				;; | ||||
| 		esac | ||||
| 	else | ||||
| 		local cmds="queue start run set show-jobs show-queued show-running abort" | ||||
| 		COMPREPLY+=($(compgen -W "${cmds}" -- ${cur})) | ||||
| 	fi | ||||
| } | ||||
| 
 | ||||
| complete  -F _laminarc laminarc | ||||
							
								
								
									
										34
									
								
								laminarc-completion.zsh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								laminarc-completion.zsh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| #compdef laminarc | ||||
| #autoload | ||||
| 
 | ||||
| _laminarc() { | ||||
| 	if (( CURRENT == 2 )); then | ||||
| 		_values "Operation" \ | ||||
| 			"queue" \ | ||||
| 			"start" \ | ||||
| 			"run" \ | ||||
| 			"set" \ | ||||
| 			"show-jobs" \ | ||||
| 			"show-queued" \ | ||||
| 			"show-running" \ | ||||
| 			"abort" | ||||
| 	else | ||||
| 		case "${words[2]}" in | ||||
| 			queue|start|run) | ||||
| 				if (( CURRENT == 3 )); then | ||||
| 					_values "Jobs" $(laminarc show-jobs) | ||||
| 				fi | ||||
| 				;; | ||||
| 			abort) | ||||
| 				if (( CURRENT == 3 )); then | ||||
| 					_values "Jobs" $(laminarc show-running | cut -d : -f 1) | ||||
| 				elif (( CURRENT == 4 )); then | ||||
| 					_values "Runs" $(laminarc show-running | cut -d : -f 2) | ||||
| 				fi | ||||
| 				;; | ||||
| 		esac | ||||
| 	fi | ||||
| } | ||||
| 
 | ||||
| _laminarc | ||||
| # vim: ft=zsh | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user