feat: regex matching

This commit is contained in:
iff 2023-08-01 19:35:22 +02:00
parent a5762bf121
commit 3e367a09dd
8 changed files with 85 additions and 93 deletions

View file

@ -8,5 +8,6 @@ pattern = [
]
suggest = [
'''
{{typo[0](path)}} {{command[1:]}}'''
{{typo[0](path)}} {{command[1:]}}
'''
]

View file

@ -6,62 +6,62 @@ pattern = [
]
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,\
{{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:]}}"""
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:]}}
"""
]

View file

@ -30,8 +30,10 @@ pattern = [
suggest = [
'''
#[executable(sudo)]
sudo {{command}}''',
sudo {{command}}
''',
'''
#[executable(doas)]
doas {{command}}''',
doas {{command}}
''',
]

View file

@ -4,13 +4,15 @@ command = "rm"
pattern = [ "is a directory", ]
suggest = [
'''
{{command}} --recursive'''
{{command}} --recursive
'''
]
[[match_err]]
pattern = [ "no such file or directory", ]
suggest = [
'''
{{command[0}} {{opt(-*)}} {{typo[-1](file)}}'''
{{command[0}} {{opt::(?:\s)-[\w]+}} {{typo[-1](file)}}
'''
]