Open chooglen opened 1 year ago
Here are my custom additions to the auto-generated completions (fish shell):
complete -c jj -n "__fish_seen_subcommand_from branch; and __fish_seen_subcommand_from delete" -f -a "(jj branch list | cut --delimiter ':' --fields 1)"
complete -c jj -n "__fish_seen_subcommand_from branch; and __fish_seen_subcommand_from forget" -f -a "(jj branch list | cut --delimiter ':' --fields 1)"
complete -c jj -n "__fish_seen_subcommand_from branch; and __fish_seen_subcommand_from rename" -f -a "(jj branch list | cut --delimiter ':' --fields 1)"
complete -c jj -n "__fish_seen_subcommand_from branch; and __fish_seen_subcommand_from set" -f -a "(jj branch list | cut --delimiter ':' --fields 1)"
complete -c jj -n "__fish_seen_subcommand_from branch; and __fish_seen_subcommand_from track" -f -a "(jj branch list --all-remotes | cut --delimiter ':' --fields 1 | grep '\w@\w')"
complete -c jj -n "__fish_seen_subcommand_from branch; and __fish_seen_subcommand_from untrack" -f -a '(
for line in (jj branch list -a | cut --delimiter ":" --fields 1)
if echo $line | grep --quiet "^\S"
set --function __local_branch $line
continue
end
if [ $line = " @git" ]
continue
end
echo "$__local_branch$(string trim $line)"
end
set --erase __local_branch
)'
As mentioned in this comment, adding that to the output of jj util completion
should be simple.
I would be happy to make that contribution, unless maintainers consider this an undue maintenance burden. In my opinion, if it does turn out to be a burden, it can just be deleted again. I don't think shell completions come with any expection of stability.
That seems fine to me.
Since #3651, jj branch list | cut --delimiter ':' --fields 1
can be replaced by jj branch list -T 'name ++ "\n"'
. Maybe the untrack
script can also be simplified somehow.
Great! I didn't think of using templates, great idea. I'll see how simple I can make it and open a PR.
Tab-completing branch names would be useful for all
branch
subcommands today execptlist
.e.g. I run into this on a regular basis:
or
It seems that Clap completion doesn't have support for this yet https://github.com/clap-rs/clap/issues/1232.