Skip to content

Commit

Permalink
Add completion for git-mv
Browse files Browse the repository at this point in the history
  • Loading branch information
magicant committed Feb 21, 2025
1 parent e4bab32 commit 1937506
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
to be ignored.
- [line-editing] Updated the completion scripts to support Git
2.48.1.
- [line-editing] Added the completion script for `git-mv`.
- Fixed a possible crash when the `read` built-in reads input in an
interactive shell.
- Added a workaround for an apparent bug in glibc's fsetpos function
Expand Down
1 change: 1 addition & 0 deletions NEWS.ja
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- `trap` 組込みはシェルが起動された時点で最初から無視されていた
シグナルも表示するようになった
- [行編集] 補完スクリプトを Git 2.48.1 相当に更新
- [行編集] git-mv の補完を追加
- 対話シェルで `read` 組込みが入力を読み込む際にクラッシュすることが
あったのを修正
- glibc の fsetpos 関数が正しく動作しないために履歴ファイルが更新
Expand Down
41 changes: 41 additions & 0 deletions share/completion/git-mv
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# (C) 2025 magicant

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

function completion/git-mv {
WORDS=(git mv "${WORDS[2,-1]}")
command -f completion//reexecute
}

function completion/git::mv:arg {

OPTIONS=( #>#
"-f --force; force move/rename even if target exists"
"-k; ignore errors when moving/renaming a file"
"-n --dry-run; don't actually move/rename files"
"-v --verbose; report what is being done"
) #<#

command -f completion//parseoptions
case $ARGOPT in
(-)
command -f completion//completeoptions
;;
('')
command -f completion//getoperands
case ${WORDS[#]} in
(0)
command -f completion/git::completepath -r
;;
(*)
complete -P "$PREFIX" -f
;;
esac
;;
esac

}


# vim: set ft=sh ts=8 sts=8 sw=8 et:

0 comments on commit 1937506

Please sign in to comment.