You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
642 B
Plaintext
24 lines
642 B
Plaintext
8 months ago
|
export def powerline [
|
||
|
bg: string
|
||
|
elem: list<any>
|
||
|
--separator = ''
|
||
|
--start = ''
|
||
|
--end = ''
|
||
|
] {
|
||
|
if ($elem | is-empty) {
|
||
|
return
|
||
|
}
|
||
|
let first = ($elem | first)
|
||
|
let last = ($elem | last)
|
||
|
|
||
|
($elem
|
||
|
| window 2
|
||
|
| each {|it|
|
||
|
$"(ansi {fg: $it.0.fg, bg: $it.0.bg})($it.0.icon? | default '') ($it.0.text? | default '')(ansi {fg: $it.0.bg, bg: $it.1.bg})($separator)"
|
||
|
}
|
||
|
| append $"(ansi {fg: $last.fg, bg: $last.bg})($last.icon? | default '') ($last.text? | default '')(ansi {fg: $last.bg, bg: $bg})($end)(ansi reset)"
|
||
|
| prepend $"(ansi {fg: $bg, bg: $first.bg})($start)"
|
||
|
| str join ""
|
||
|
)
|
||
|
}
|