-
Notifications
You must be signed in to change notification settings - Fork 440
Nushell
YPares edited this page Apr 4, 2025
·
3 revisions
def to-group-name [] {
str replace -ra "[()'\":,;|]" "" |
str replace -ra '[\.\-\s]' "_"
}
# Get the jj log as a table
export def main [
--revset (-r): string
...columns: string
] {
let columns = if ($columns | is-empty) {
[change_id description "author.name()" "author.timestamp()"]
} else {
$columns
}
let parser = $columns | each { $"{($in | to-group-name)}" } | str join (char fs)
( jj log ...(if $revset != null {[-r $revset]} else {[]})
--no-graph
-T $"($columns | str join $"++'(char fs)'++") ++ '(char rs)'"
) |
str trim --right --char (char rs) |
split row (char rs) |
parse $parser
}
Example of use:
jj-nu-log -r something change_id description "author.email()" "author.timestamp()" | update author_timestamp {into datetime}