auraline 0.6.0

utility that renders information into a string suitable to be embedded in the shell prompt.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::{chunk::Chunk, options::Options, style::to_superscript};
use smol_str::{format_smolstr, SmolStr};

pub async fn show(opts: &Options) -> Option<Chunk<SmolStr>> {
    let exit_code = opts.exit_code?;
    if exit_code == 0 {
        None
    } else {
        let mut buffer = itoa::Buffer::new();
        let exit_code = buffer.format(exit_code);
        Some(Chunk::new(
            "✘",
            format_smolstr!("{}", to_superscript(exit_code)),
        ))
    }
}