mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	feat: make disown command get last job if id isnt suppied as arg
This commit is contained in:
		
							parent
							
								
									bbff7098c2
								
							
						
					
					
						commit
						dde56cbb4f
					
				| @ -1,14 +1,25 @@ | ||||
| local commander = require 'commander' | ||||
| 
 | ||||
| commander.register('disown', function(args) | ||||
| 	local id = tonumber(args[1]) | ||||
| 	if not id then | ||||
| 		print 'invalid id for job' | ||||
| 	if #hilbish.jobs.all() == 0 then | ||||
| 		print 'disown: no current job' | ||||
| 		return 1 | ||||
| 	end | ||||
| 
 | ||||
| 	local id | ||||
| 	if #args < 0 then | ||||
| 		id = tonumber(args[1]) | ||||
| 		if not id then | ||||
| 			print 'disown: invalid id for job' | ||||
| 			return 1 | ||||
| 		end | ||||
| 	else | ||||
| 		id = hilbish.jobs.last().id | ||||
| 	end | ||||
| 
 | ||||
| 	local ok = pcall(hilbish.jobs.disown, id) | ||||
| 	if not ok then | ||||
| 		print 'job does not exist' | ||||
| 		print 'disown: job does not exist' | ||||
| 		return 2 | ||||
| 	end | ||||
| end) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user