2022-05-21 15:38:26 +00:00
|
|
|
local commander = require 'commander'
|
|
|
|
|
|
|
|
commander.register('disown', function(args)
|
2022-05-21 15:54:07 +00:00
|
|
|
if #hilbish.jobs.all() == 0 then
|
|
|
|
print 'disown: no current job'
|
2022-05-21 15:38:26 +00:00
|
|
|
return 1
|
|
|
|
end
|
|
|
|
|
2022-05-21 15:54:07 +00:00
|
|
|
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
|
|
|
|
|
2022-05-21 15:38:26 +00:00
|
|
|
local ok = pcall(hilbish.jobs.disown, id)
|
|
|
|
if not ok then
|
2022-05-21 15:54:07 +00:00
|
|
|
print 'disown: job does not exist'
|
|
|
|
return 2
|
2022-05-21 15:38:26 +00:00
|
|
|
end
|
|
|
|
end)
|