omp prompt for git-bug

main
jolheiser 2025-07-26 06:35:03 -05:00
parent 26612ee1d2
commit fb26c31776
No known key found for this signature in database
1 changed files with 24 additions and 2 deletions

View File

@ -1,7 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
let let
unicode = x: builtins.fromJSON ''"${x}"''; unicode = x: builtins.fromJSON ''"${x}"'';
script = pkgs.writeShellApplication { jjScript = pkgs.writeShellApplication {
name = "jj-prompt"; name = "jj-prompt";
runtimeInputs = [ pkgs.jujutsu ]; runtimeInputs = [ pkgs.jujutsu ];
text = text =
@ -40,6 +40,16 @@ let
' '
''; '';
}; };
gitBugScript = pkgs.writeShellApplication {
name = "git-bug-prompt";
runtimeInputs = [
pkgs.git-bug
pkgs.jq
];
text = ''
git-bug bug --format json status:open | jq 'length'
'';
};
in in
{ {
programs.oh-my-posh = { programs.oh-my-posh = {
@ -110,12 +120,23 @@ in
foreground = "p:black"; foreground = "p:black";
powerline_symbol = unicode "\\ue0b0"; powerline_symbol = unicode "\\ue0b0";
properties = { properties = {
script = "${script}/bin/jj-prompt"; script = "${jjScript}/bin/jj-prompt";
}; };
style = "powerline"; style = "powerline";
template = "{{ if (glob \".jj\")}} {{ .Output }} {{ end }}"; template = "{{ if (glob \".jj\")}} {{ .Output }} {{ end }}";
type = "command"; type = "command";
} }
{
background = "p:maroon";
foreground = "p:black";
powerline_symbol = unicode "\\ue0b0";
properties = {
script = "${gitBugScript}/bin/git-bug-prompt";
};
style = "powerline";
template = "{{ if (glob \".git/refs/bugs\")}} 󰃤 {{ .Output }} {{ end }}";
type = "command";
}
{ {
background = "p:blue"; background = "p:blue";
background_templates = [ "{{ if gt .Code 0 }}p:red{{ end }}" ]; background_templates = [ "{{ if gt .Code 0 }}p:red{{ end }}" ];
@ -142,6 +163,7 @@ in
lavender = "#B4BEFE"; lavender = "#B4BEFE";
orange = "#FAB387"; orange = "#FAB387";
red = "#F38BA8"; red = "#F38BA8";
maroon = "#EBA0AC";
white = "#CDD6F4"; white = "#CDD6F4";
yellow = "#F9E2AF"; yellow = "#F9E2AF";
}; };