details: make triangle in prompt change color based on command result

pull/21/head
TorchedSammy 2021-03-30 19:48:37 -04:00
parent f20be5153f
commit cb6f17c8fa
1 changed files with 16 additions and 3 deletions

View File

@ -1,8 +1,21 @@
-- Default Hilbish config
ansikit = require 'ansikit'
bait = require 'bait'
prompt(ansikit.text(
'{blue}%u {cyan}%d {green}∆{reset} '
))
function doPrompt(fail)
prompt(ansikit.text(
'{blue}%u {cyan}%d ' .. (fail and '{red}' or '{green}') .. '∆{reset} '
))
end
doPrompt()
bait.catch('command.fail', function()
doPrompt(true)
end)
bait.catch('command.success', function()
doPrompt()
end)
--hook("tab complete", function ())