Skip to content

Instantly share code, notes, and snippets.

@DeaR DeaR/ignoreeof.lua
Last active Jun 17, 2016

Embed
What would you like to do?
IGNOREEOF support for NYAGOS
share._ignoreeof_now = 0
share.org_ignoreeof_filter = nyagos.filter
nyagos.filter = function(args)
share._ignoreeof_now = 0
if share.org_ignoreeof_filter then
return share.org_ignoreeof_filter(args)
end
end
nyagos.bindkey('C_D', function(this)
local max = share.ignoreeof or tonumber(nyagos.getenv('IGNOREEOF')) or -1
if this.text:len() > 0 then
this:call('DELETE_OR_ABORT')
elseif max < 0 or share._ignoreeof_now < max then
share._ignoreeof_now = share._ignoreeof_now + 1
nyagos.write('Use "exit" to leave the shell.')
return false
else
os.exit()
end
end)
@DeaR

This comment has been minimized.

Copy link
Owner Author

DeaR commented Jun 13, 2016

share.ignoreeofもしくは%IGNOREEOF%に回数を設定(Default:-1)
負数だと無制限

欠点としてexitがhistoryに残る
(終了させる他の方法が思いつかなかった)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.