|
| 1 | +function _tide_item_jj |
| 2 | + if not command -sq jj; or not jj root --quiet &>/dev/null |
| 3 | + return 1 |
| 4 | + end |
| 5 | + |
| 6 | + set jj_status (jj log -r@ -n1 --ignore-working-copy --no-graph --color always -T ' |
| 7 | + separate(" ", |
| 8 | + bookmarks.map(|x| if( |
| 9 | + x.name().substr(0, 10).starts_with(x.name()), |
| 10 | + x.name().substr(0, 10), |
| 11 | + x.name().substr(0, 9) ++ "…") |
| 12 | + ).join(" "), |
| 13 | + tags.map(|x| if( |
| 14 | + x.name().substr(0, 10).starts_with(x.name()), |
| 15 | + x.name().substr(0, 10), |
| 16 | + x.name().substr(0, 9) ++ "…") |
| 17 | + ).join(" "), |
| 18 | + surround("\"","\"", |
| 19 | + if( |
| 20 | + description.first_line().substr(0, 24).starts_with(description.first_line()), |
| 21 | + description.first_line().substr(0, 24), |
| 22 | + description.first_line().substr(0, 23) ++ "…" |
| 23 | + ) |
| 24 | + ), |
| 25 | + change_id.shortest(), |
| 26 | + commit_id.shortest(), |
| 27 | + diff.files().filter(|f| f.status() == "modified").len() ++ "m", |
| 28 | + diff.stat().total_added() ++ "+", |
| 29 | + diff.stat().total_removed() ++ "-", |
| 30 | + if(conflict, "conflict"), |
| 31 | + if(divergent, "divergent"), |
| 32 | + if(hidden, "hidden"), |
| 33 | + )' | string trim) |
| 34 | + _tide_print_item jj $tide_jj_icon' ' "($jj_status)" |
| 35 | +end |
0 commit comments