new script: pue (compact pueue status)
This commit is contained in:
		
							parent
							
								
									dfb4394dbf
								
							
						
					
					
						commit
						f8d866b623
					
				
					 1 changed files with 40 additions and 0 deletions
				
			
		
							
								
								
									
										40
									
								
								misc/pue
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										40
									
								
								misc/pue
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,40 @@
 | 
			
		|||
#!/bin/zsh
 | 
			
		||||
 | 
			
		||||
JQ_PREDEF='
 | 
			
		||||
def colors:
 | 
			
		||||
 {
 | 
			
		||||
 "black": "\u001b[30m",
 | 
			
		||||
 "red": "\u001b[31m",
 | 
			
		||||
 "green": "\u001b[32m",
 | 
			
		||||
 "yellow": "\u001b[33m",
 | 
			
		||||
 "blue": "\u001b[34m",
 | 
			
		||||
 "magenta": "\u001b[35m",
 | 
			
		||||
 "cyan": "\u001b[36m",
 | 
			
		||||
 "lightgray": "\u001b[37m",
 | 
			
		||||
 "reset": "\u001b[0m",
 | 
			
		||||
 "gray": "\u001b[90m",
 | 
			
		||||
 "lightred": "\u001b[91m",
 | 
			
		||||
 "lightgreen": "\u001b[92m",
 | 
			
		||||
 "lightyellow": "\u001b[93m",
 | 
			
		||||
 "lightblue": "\u001b[94m",
 | 
			
		||||
 "lightmagenta": "\u001b[95m",
 | 
			
		||||
 "lightcyan": "\u001b[96m",
 | 
			
		||||
 "white": "\u001b[97m",
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
def gettime: if . == null then "?" else [scan("\\d\\d:\\d\\d")][0] end;
 | 
			
		||||
'
 | 
			
		||||
 | 
			
		||||
#pueue compact output
 | 
			
		||||
JQ_STATUS=$JQ_PREDEF'
 | 
			
		||||
 | 
			
		||||
def prefix:
 | 
			
		||||
	if .status == "Done" then colors.lightgreen + "✔ "
 | 
			
		||||
	elif .status == "Running" then colors.lightyellow + "… "
 | 
			
		||||
	else colors.gray + "⌛"
 | 
			
		||||
	end;
 | 
			
		||||
 | 
			
		||||
.tasks[]| "\(prefix)\t\(.id)\t\(.command)\t\(.start|gettime) - \(.end|gettime)" + colors.reset
 | 
			
		||||
'
 | 
			
		||||
 | 
			
		||||
pueue status -j | jq -r $JQ_STATUS | column -t -s $'\t'
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue