Nushell - jj-vcs/jj GitHub Wiki
Creating and syncing GitHub PRs using changes and their descriptions
jj pr
can be used to sync changes with GitHub.
This script uses gh
CLI under the hood.
Unlike gh
, jj pr
's subcommands take revsets with -c
.
For example jj pr create -c @-
.
https://github.com/eopb/jj-gh-pr.nu
> jj pr --help
Nushell command for opening Jujutsu PRs with GitHub
Usage:
> jj pr
Subcommands:
jj pr create (custom) - Create a PR for the current revision
jj pr merge (custom) - Merge an open PR
jj pr update base (custom) - Update a PRs base
jj pr update desc (custom) - Update a PR description with revision details
jj pr view (custom) - View details for a PR
Flags:
-h, --help: Display the help message for this command
Input/output types:
╭───┬───────┬────────╮
│ # │ input │ output │
├───┼───────┼────────┤
│ 0 │ any │ any │
╰───┴───────┴────────╯
Gathering the output of jj log as a nushell table
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}
See nujj for a nushell module which exposes several nushell/jj utilities, including this.