rules: add touch; update formats

This commit is contained in:
iff 2023-08-07 18:35:07 +02:00
parent 2f3ba438ea
commit e214cf24ba
8 changed files with 26 additions and 30 deletions

View file

@ -6,8 +6,7 @@ pattern = [
] ]
suggest = [ suggest = [
''' '''
cat {{typo[1](file)}} cat {{typo[1](file)}} '''
'''
] ]
[[match_err]] [[match_err]]
@ -16,6 +15,5 @@ pattern = [
] ]
suggest = [ suggest = [
''' '''
ls {{command[1:]}} --almost-all --color=auto --group-directories-first ls {{command[1:]}} --almost-all --color=auto --group-directories-first '''
'''
] ]

View file

@ -9,6 +9,5 @@ pattern = [
suggest = [ suggest = [
''' '''
#[err_contains(no such file or directory)] #[err_contains(no such file or directory)]
mkdir -p {{command[1]}} mkdir -p {{command[1]}} '''
'''
] ]

View file

@ -4,10 +4,9 @@ command = "general"
pattern = [ pattern = [
"command not found", "command not found",
"unknown command", "unknown command",
"nu::shell::external_command", "nu::shell::external_command"
] ]
suggest = [ suggest = [
''' '''
{{typo[0](path)}} {{command[1:]}} {{typo[0](path)}} {{command[1:]}} '''
'''
] ]

View file

@ -72,8 +72,7 @@ pattern = [
suggest = [ suggest = [
''' '''
#[cmd_contains(checkout)] #[cmd_contains(checkout)]
git checkout {{typo[2]({{shell(git branch)}})}} git checkout {{typo[2]({{shell(git branch)}})}} '''
'''
] ]
[[match_err]] [[match_err]]
@ -83,8 +82,7 @@ pattern = [
suggest = [ suggest = [
''' '''
#[cmd_contains(push)] #[cmd_contains(push)]
git push --set-upstream origin {{shell(git rev-parse --abbrev-ref HEAD)}} git push --set-upstream origin {{shell(git rev-parse --abbrev-ref HEAD)}} '''
'''
] ]
[[match_err]] [[match_err]]
@ -94,8 +92,7 @@ pattern = [
suggest = [ suggest = [
''' '''
#[cmd_contains(pull)] #[cmd_contains(pull)]
git pull --set-upstream origin {{shell(git rev-parse --abbrev-ref HEAD)}} git pull --set-upstream origin {{shell(git rev-parse --abbrev-ref HEAD)}} '''
'''
] ]
[[match_err]] [[match_err]]
@ -105,6 +102,5 @@ pattern = [
suggest = [ suggest = [
''' '''
#[cmd_contains(branch)] #[cmd_contains(branch)]
git checkout {{command[2]}} git checkout {{command[2]}} '''
'''
] ]

View file

@ -7,6 +7,5 @@ pattern = [
suggest = [ suggest = [
''' '''
#[err_contains(no such file or directory)] #[err_contains(no such file or directory)]
{{command}} --parents {{command}} --parents '''
'''
] ]

View file

@ -25,15 +25,13 @@ pattern = [
"updatedb: can not open a temporary file", "updatedb: can not open a temporary file",
"use `sudo`", "use `sudo`",
"you don't have access to the history db.", "you don't have access to the history db.",
"you don't have write permissions", "you don't have write permissions"
] ]
suggest = [ suggest = [
''' '''
#[executable(sudo)] #[executable(sudo)]
sudo {{command}} sudo {{command}} ''',
''',
''' '''
#[executable(doas)] #[executable(doas)]
doas {{command}} doas {{command}} '''
''',
] ]

View file

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

9
rules/touch.toml Normal file
View file

@ -0,0 +1,9 @@
command = "touch"
[[match_err]]
pattern = [ "No such file or directory" ]
suggest = [
'''
mkdir --parents {{cmd::(?:\s)+(.*[\\\/])(?:\s)*}}
touch {{command[1:]}} '''
]