Rosettea / Hilbish

🌓 The Moon-powered shell! A comfy and extensible shell for Lua fans! 🌺 ✨
https://rosettea.github.io/Hilbish/
MIT License
496 stars 21 forks source link

feat: add function for commanders to stop execution #255

Closed TorchedSammy closed 9 months ago

TorchedSammy commented 1 year ago

idea: pass some kind of self arg to commanders which provides an exit command. this is kind of an alternative to a return with exit code

(would be a breaking change - but shouldnt be one) example:

local commander = require 'commander'

commander.register('test', function(self, args)
    self:exit(2)
end)
superpowers04 commented 10 months ago

This would probably not work properly unless the function is somehow run in a seperate thread. Also the example provided is completely incompatible with the current function(args, sink) currently used. It might be better to make sending an EOF to sink.out stop monitoring the function, or make a sink closable

TorchedSammy commented 9 months ago

i don't remember why i thought of this in the first place, so i think i'm just gonna close.