Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
magicant committed Feb 18, 2025
1 parent 25888d6 commit 67d9994
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 14 deletions.
2 changes: 1 addition & 1 deletion share/completion/git-add
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function completion/git::add:arg {
"--no-all --no-ignore-removal; add only new and modified files"
"--no-warn-embedded-repo; allow adding embedded repositories"
"p --patch; interactively choose patch hunks to add"
"--pathspec-from-file:; read pathspecs from file"
"--pathspec-file-nul; use nul as separator for pathspecs"
"--pathspec-from-file:; read pathspecs from file"
"--refresh; refresh stat info in the index without adding"
"--renormalize; re-apply \"clean\" process"
"--sparse; update index outside of sparse-checkout cone"
Expand Down
2 changes: 1 addition & 1 deletion share/completion/git-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ function completion/git::checkout:arg {
"--overlay; don't remove files from the index"
"--overwrite-ignore; overwrite ignored files"
"p --patch; interactively choose hunks to check out"
"--pathspec-from-file:; read pathspecs from file"
"--pathspec-file-nul; use nul as separator for pathspecs"
"--pathspec-from-file:; read pathspecs from file"
"--progress; show progress"
"--recurse-submodules; propagate checkout in submodules"
"q --quiet; print error and warning messages only"
Expand Down
2 changes: 1 addition & 1 deletion share/completion/git-commit
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function completion/git::commit:arg {
"n --no-verify; bypass the pre-commit and commit-msg hooks"
"o --only; commit operand files only"
"p --patch; interactive choose patch hunks to commit"
"--pathspec-from-file:; read pathspecs from file"
"--pathspec-file-nul; use nul as separator for pathspecs"
"--pathspec-from-file:; read pathspecs from file"
"--porcelain; dry-run with the machine-friendly format"
"q --quiet; suppress the commit summary message"
"--reset-author; ignore the date and author of the original commit"
Expand Down
9 changes: 6 additions & 3 deletions share/completion/git-reflog
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# (C) 2016 magicant
# (C) 2016-2025 magicant

# Completion script for the "git-reflog" command.
# Supports Git 2.6.2.
# Supports Git 2.48.1.

function completion/git-reflog {
WORDS=(git reflog "${WORDS[2,-1]}")
Expand All @@ -10,7 +10,7 @@ function completion/git-reflog {

function completion/git::reflog:arg
if [ ${WORDS[#]} -le 1 ]; then
complete -P "$PREFIX" delete exists expire show
complete -P "$PREFIX" delete exists expire list show
else
WORDS=("${WORDS[2,-1]}")
if command -vf "completion/git::reflog:${WORDS[1]}:arg" >/dev/null 2>&1; then
Expand All @@ -31,6 +31,9 @@ function completion/git::reflog:exists:arg {
# Not supported, since the expire subcommand is not mainly for interactive use.
# function completion/git::reflog:expire:arg

# The list subcommand takes no arguments.
# function completion/git::reflog:list:arg

function completion/git::reflog:show:arg {
WORDS=(git log -g --abbrev-commit --pretty=oneline "${WORDS[2,-1]}")
command -f completion//reexecute
Expand Down
30 changes: 27 additions & 3 deletions share/completion/git-remote
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# (C) 2011-2019 magicant
# (C) 2011-2025 magicant

# Completion script for the "git-remote" command.
# Supports Git 1.7.7.
# Supports Git 2.48.1.

function completion/git-remote {
WORDS=(git remote "${WORDS[2,-1]}")
Expand Down Expand Up @@ -29,9 +29,10 @@ function completion/git::remote:arg {
(*) #>>#
complete -P "$PREFIX" -D "add a remote" add
complete -P "$PREFIX" -D "rename a remote" rename
complete -P "$PREFIX" -D "remove a remote" rm
complete -P "$PREFIX" -D "remove a remote" remove
complete -P "$PREFIX" -D "set the default branch of a remote" set-head
complete -P "$PREFIX" -D "set remote-tracking branches" set-branches
complete -P "$PREFIX" -D "show the URL of a remote" get-url
complete -P "$PREFIX" -D "set the URL of a remote" set-url
complete -P "$PREFIX" -D "show a remote" show
complete -P "$PREFIX" -D "delete remote-tracking branches that no longer exist on a remote" prune
Expand Down Expand Up @@ -82,6 +83,10 @@ function completion/git::remote:rename:arg {
}

function completion/git::remote:rm:arg {
command -f completion/git::remote:remove:arg
}

function completion/git::remote:remove:arg {
command -f completion/git::completeremote
}

Expand Down Expand Up @@ -123,6 +128,25 @@ function completion/git::remote:set-branches:arg {
command -f completion/git::remote:set-head:arg "$@"
}

function completion/git::remote:get-url:arg {

OPTIONS=( #>#
"--all; list all URLs for the remote"
"--push; get push URLs instead of fetch URLs"
) #<#

command -f completion//parseoptions
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
('')
command -f completion/git::completeremote
;;
esac

}

function completion/git::remote:set-url:arg {

OPTIONS=( #>#
Expand Down
6 changes: 3 additions & 3 deletions share/completion/git-request-pull
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# (C) 2012 magicant
# (C) 2012-2025 magicant

# Completion script for the "git" command.
# Supports Git 1.8.0.2.
# Supports Git 2.48.1.

function completion/git-request-pull {
WORDS=(git request-pull "${WORDS[2,-1]}")
Expand All @@ -11,7 +11,7 @@ function completion/git-request-pull {
function completion/git::request-pull:arg {

OPTIONS=( #>#
"p; print a patch"
"p; include a patch"
) #<#

command -f completion//parseoptions -es
Expand Down
13 changes: 11 additions & 2 deletions share/completion/git-reset
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# (C) 2011 magicant
# (C) 2011-2025 magicant

# Completion script for the "git-reset" command.
# Supports Git 1.7.7.
# Supports Git 2.48.1.

function completion/git-reset {
WORDS=(git reset "${WORDS[2,-1]}")
Expand All @@ -15,8 +15,17 @@ function completion/git::reset:arg {
"--keep; like --hard, but keep working tree changes"
"--merge; reset out of a conflicted merge"
"--mixed; reset the index but keep the working tree"
"N --intent-to-add; keep removed files as intent-to-add"
"--no-intent-to-add"
"--no-patch"
"--no-recurse-submodules; don't reset submodules"
"--no-refresh; don't refresh the index"
"p --patch; interactively choose patch hunks to reset"
"--pathspec-file-nul; use nul as separator for pathspecs"
"--pathspec-from-file:; read pathspecs from a file"
"q --quiet; print error and warning messages only"
"--recurse-submodules; also reset submodules"
"--refresh; refresh the index"
"--soft; keep the index and working tree intact"
) #<#

Expand Down

0 comments on commit 67d9994

Please sign in to comment.