Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ unsort the completions in git checkout #1022

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions custom-completions/git/git-completions.nu
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def "nu-complete git switch" [] {
}

def "nu-complete git checkout" [] {
(nu-complete git local branches)
let table_of_checkouts = (nu-complete git local branches)
| parse "{value}"
| insert description "local branch"
| append (nu-complete git remote branches nonlocal without prefix
Expand All @@ -64,7 +64,15 @@ def "nu-complete git checkout" [] {
| insert description "remote branch")
| append (nu-complete git files | where description != "Untracked" | select value | insert description "git file")
| append (nu-complete git commits all)
| append (nu-complete git files | where description != "Untracked" | select value)

return {
options: {
case_sensitive: false,
completion_algorithm: prefix,
sort: false,
},
completions: $table_of_checkouts
}
}

# Arguments to `git rebase --onto <arg1> <arg2>`
Expand Down Expand Up @@ -125,7 +133,7 @@ def "nu-complete git files" [] {
def "nu-complete git built-in-refs" [] {
[HEAD FETCH_HEAD ORIG_HEAD]
}

def "nu-complete git refs" [] {
nu-complete git local branches
| parse "{value}"
Expand Down
Loading