From cb6f17c8fa0b0cd578db71b62b671356ad380eee Mon Sep 17 00:00:00 2001 From: TorchedSammy <38820196+TorchedSammy@users.noreply.github.com> Date: Tue, 30 Mar 2021 19:48:37 -0400 Subject: [PATCH] details: make triangle in prompt change color based on command result --- .hilbishrc.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.hilbishrc.lua b/.hilbishrc.lua index 770e02f..2087d94 100644 --- a/.hilbishrc.lua +++ b/.hilbishrc.lua @@ -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 ())