Skip to content

Commit 64ae5a2

Browse files
author
Hiroki Konishi
committed
Update: implement git sub command option completion
1 parent ae4acdb commit 64ae5a2

26 files changed

+531
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
pmy
22
tags
3+
4+
# Mypy cache directory
5+
.mypy_cache/

rules/git_pmy_rules.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@
44
"cmdGroups": [
55
{
66
"tag": "",
7-
"stmt": "%git_sub",
7+
"stmt": "%git/sub",
88
"after": "awk '{print $1}'"
99
}
1010
],
1111
"fuzzyFinderCmd": "fzf -0 -1 ",
1212
"bufferLeft": "git ",
1313
"bufferRight": "[]"
1414
},
15+
{
16+
"regexpLeft": "^git (?P<sub_cmd>[A-Za-z\\-]+)(?P<body>.*)(-|--)$",
17+
"cmdGroups": [
18+
{
19+
"tag": "",
20+
"stmt": "%git/<sub_cmd>_option",
21+
"after": "awk '{print $1}'"
22+
}
23+
],
24+
"fuzzyFinderCmd": "fzf -0 -1 ",
25+
"bufferLeft": "git <sub_cmd><body>",
26+
"bufferRight": "[]"
27+
},
1528
{
1629
"regexpLeft": "(?P<body>git (co|checkout)) *(?P<query>.*)$",
1730
"cmdGroups": [

snippets/git/add_option.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-n --dry-run dry run
2+
-v --verbose be verbose
3+
-i --interactive interactive picking
4+
-p --patch select hunks interactively
5+
-e --edit edit current diff and apply
6+
-f --force allow adding otherwise ignored files
7+
-u --update update tracked files
8+
--renormalize renormalize EOL of tracked files (implies -u)
9+
-N --intent-to-add record only the fact that the path will be added later
10+
-A --all add changes from all tracked and untracked files
11+
--ignore-removal ignore paths removed in the working tree (same as --no-all)
12+
--refresh don't add, only refresh the index
13+
--ignore-errors just skip files which cannot be added because of errors
14+
--ignore-missing check if - even missing - files are ignored in dry run
15+
--chmod (+|-)x override the executable bit of the listed files

snippets/git/bisect_option.txt

Whitespace-only changes.

snippets/git/branch_option.txt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-v --verbose show hash and subject, give twice for upstream branch
2+
-q --quiet suppress informational messages
3+
-t --track set up tracking mode (see git-pull(1))
4+
-u --set-upstream-to <upstream> change the upstream info
5+
--unset-upstream Unset the upstream info
6+
--color [=<when>] use colored output
7+
-r --remotes act on remote-tracking branches
8+
--contains <commit> print only branches that contain the commit
9+
--no-contains <commit> print only branches that don't contain the commit
10+
--abbrev [=<n>] use <n> digits to display SHA-1s Specific git-branch actions:
11+
-a --all list both remote-tracking and local branches
12+
-d --delete delete fully merged branch
13+
-D delete branch (even if not merged)
14+
-m --move move/rename a branch and its reflog
15+
-M move/rename a branch, even if target exists
16+
-c --copy copy a branch and its reflog
17+
-C copy a branch, even if target exists
18+
-l --list list branch names
19+
--create-reflog create the branch's reflog
20+
--edit-description edit the description for the branch
21+
-f --force force creation, move/rename, deletion
22+
--merged <commit> print only branches that are merged
23+
--no-merged <commit> print only branches that are not merged
24+
--column [=<style>] list branches in columns
25+
--sort <key> field name to sort on
26+
--points-at <object> print only branches of the object
27+
-i --ignore-case sorting and filtering are case insensitive
28+
--format <format> format to use for the output

snippets/git/checkout_option.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-q --quiet suppress progress reporting
2+
-b <branch> create and checkout a new branch
3+
-B <branch> create/reset and checkout a branch
4+
-l create reflog for new branch
5+
--detach detach HEAD at named commit
6+
-t --track set upstream info for new branch
7+
--orphan <new-branch> new unparented branch
8+
-2 --ours checkout our version for unmerged files
9+
-3 --theirs checkout their version for unmerged files
10+
-f --force force checkout (throw away local modifications)
11+
-m --merge perform a 3-way merge with the new branch
12+
--overwrite-ignore update ignored files (default)
13+
--conflict <style> conflict style (merge or diff3)
14+
-p --patch select hunks interactively
15+
--ignore-skip-worktree-bits do not limit pathspecs to sparse entries only
16+
--ignore-other-worktrees do not check if another worktree is holding the given ref
17+
--recurse-submodules [=<checkout>] control recursive updating of submodules
18+
--progress force progress reporting

snippets/git/clone_option.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
-v --verbose be more verbose
2+
-q --quiet be more quiet
3+
--progress force progress reporting
4+
-n --no-checkout don't create a checkout
5+
--bare create a bare repository
6+
--mirror create a mirror repository (implies bare)
7+
-l --local to clone from a local repository
8+
--no-hardlinks don't use local hardlinks, always copy
9+
-s --shared setup as shared repository
10+
--recurse-submodules [=<pathspec>] initialize submodules in the clone
11+
-j --jobs <n> number of submodules cloned in parallel
12+
--template <template-directory> directory from which templates will be used
13+
--reference <repo> reference repository
14+
--reference-if-able <repo> reference repository
15+
--dissociate use --reference only while cloning
16+
-o --origin <name> use <name> instead of 'origin' to track upstream
17+
-b --branch <branch> checkout <branch> instead of the remote's HEAD
18+
-u --upload-pack <path> path to git-upload-pack on the remote
19+
--depth <depth> create a shallow clone of that depth
20+
--shallow-since <time> create a shallow clone since a specific time
21+
--shallow-exclude <revision> deepen history of shallow clone, excluding rev
22+
--single-branch clone only one branch, HEAD or --branch
23+
--no-tags don't clone any tags, and make later fetches not to follow them
24+
--shallow-submodules any cloned submodules will be shallow
25+
--separate-git-dir <gitdir> separate git dir from working tree
26+
-c --config <key=value> set config inside the new repository
27+
-4 --ipv4 use IPv4 addresses only
28+
-6 --ipv6 use IPv6 addresses only
29+
--filter <args> object filtering

snippets/git/commit_option.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
-q --quiet suppress summary after successful commit
2+
-v --verbose show diff in commit message template Commit message options
3+
-F --file <file> read message from file
4+
--author <author> override author for commit
5+
--date <date> override date for commit
6+
-m --message <message> commit message
7+
-c --reedit-message <commit> reuse and edit message from specified commit
8+
-C --reuse-message <commit> reuse message from specified commit
9+
--fixup <commit> use autosquash formatted message to fixup specified commit
10+
--squash <commit> use autosquash formatted message to squash specified commit
11+
--reset-author the commit is authored by me now (used with -C/-c/--amend)
12+
-s --signoff add Signed-off-by:
13+
-t --template <file> use specified template file
14+
-e --edit force edit of commit
15+
--cleanup <default> how to strip spaces and #comments from message
16+
--status include status in commit message template
17+
-S --gpg-sign [=<key-id>] GPG sign commit Commit contents options
18+
-a --all commit all changed files
19+
-i --include add specified files to index for commit
20+
--interactive interactively add files
21+
-p --patch interactively add changes
22+
-o --only commit only specified files
23+
-n --no-verify bypass pre-commit and commit-msg hooks
24+
--dry-run show what would be committed
25+
--short show status concisely
26+
--branch show branch information
27+
--ahead-behind compute full ahead/behind values
28+
--porcelain machine-readable output
29+
--long show status in long format (default)
30+
-z --null terminate entries with NUL
31+
--amend amend previous commit
32+
--no-post-rewrite bypass post-rewrite hook
33+
-u --untracked-files [=<mode>] show untracked files, optional modes: all, normal, no. (Default: all)

snippets/git/diff_option.txt

Whitespace-only changes.

snippets/git/dump_all_options.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env zsh
2+
3+
for x in $(cat sub.txt | awk '{print $1}'); do git ${x} -h > ${x}_option.txt 2>&1; done

0 commit comments

Comments
 (0)