pay-respects/rules/git.toml
2024-12-29 02:19:36 +01:00

135 lines
1.6 KiB
TOML

command = "git"
[[match_err]]
pattern = [
"is not a git command"
]
suggest = [
'''
{{command[0]}} {{typo[1](
add,
am,
archive,
bisect,
branch,
bundle,
checkout,
cherry-pick,
citool,
clean,
clone,
commit,
describe,
diff,
fetch,
format-patch,
gc,
gitk,
grep,
gui,
init,
log,
maintenance,
merge,
mv,
notes,
pull,
push,
range-diff,
rebase,
reset,
restore,
revert,
rm,
scalar,
shortlog,
show,
sparse-checkout,
stash,
status,
submodule,
switch,
tag,
worktree,
config,
fast-export,
fast-import,
filter-branch,
mergetool,
pack-refs,
prune,
reflog,
remote,
repack,
replace,
)}} {{command[2:]}}'''
]
[[match_err]]
pattern = [
"did not match any file"
]
suggest = [
'''
#[cmd_contains(checkout)]
git checkout {{typo[2]({{shell(git branch | sed 's/^*//')}})}} ''',
'''
#[cmd_contains(checkout)]
git branch {{command[2]}} && \
git checkout {{command[2]}} '''
]
[[match_err]]
pattern = [
"has no upstream branch"
]
suggest = [
'''
#[cmd_contains(push)]
git push --set-upstream origin {{shell(git rev-parse --abbrev-ref HEAD)}} '''
]
[[match_err]]
pattern = [
"no tracking information for the current branch"
]
suggest = [
'''
#[cmd_contains(pull)]
git pull --set-upstream origin {{shell(git rev-parse --abbrev-ref HEAD)}} '''
]
[[match_err]]
pattern = [
"a branch named"
]
suggest = [
'''
#[cmd_contains(branch)]
git checkout {{command[2]}} '''
]
[[match_err]]
pattern = [
"updates were rejected"
]
suggest = [
'''
#[cmd_contains(push)]
git pull && \
{{command}} ''',
'''
#[cmd_contains(push)]
{{command}} --force '''
]
[[match_err]]
pattern = [
"you have unstaged changes"
]
suggest = [
'''
git stash && \
{{command}} && \
git stash pop '''
]