From 9be1d040c45430f585a026ef4ff522b04638f901 Mon Sep 17 00:00:00 2001 From: iff Date: Fri, 4 Aug 2023 02:42:16 +0200 Subject: [PATCH] format: uniform rule style --- README.md | 9 ++++++--- rules/general.toml | 4 +++- rules/git.toml | 3 ++- rules/privilege.toml | 6 ++++-- rules/rm.toml | 8 ++++++-- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2e93a54..e521fc8 100644 --- a/README.md +++ b/README.md @@ -61,10 +61,12 @@ command = "world" # note that the error is formatted to lowercase without extra spaces pattern = [ "pattern 1", - "pattern 2", + "pattern 2" ] # this will change the first argument to `fix`, while keeping the rest intact -suggest = [ "{{command[0]}} fix {{command[2:]}}" ] +suggest = [ + "{{command[0]}} fix {{command[2:]}}", +] [[match_err]] pattern = [ @@ -76,7 +78,8 @@ pattern = [ suggest = [ ''' #[executable(sudo), !cmd_contains(sudo)] -sudo {{command}}''' +sudo {{command}} +''' ] ``` diff --git a/rules/general.toml b/rules/general.toml index bc7365b..a5c236a 100644 --- a/rules/general.toml +++ b/rules/general.toml @@ -7,5 +7,7 @@ pattern = [ "nu::shell::external_command", ] suggest = [ -'''{{typo[0](path)}} {{command[1:]}}''' +''' +{{typo[0](path)}} {{command[1:]}} +''' ] diff --git a/rules/git.toml b/rules/git.toml index 9ab3964..8685761 100644 --- a/rules/git.toml +++ b/rules/git.toml @@ -95,7 +95,8 @@ suggest = [ ''' #[cmd_contains(pull)] git pull --set-upstream origin {{shell(git rev-parse --abbrev-ref HEAD)}} -git pull''' +git pull +''' ] [[match_err]] diff --git a/rules/privilege.toml b/rules/privilege.toml index 699fce6..d9ab582 100644 --- a/rules/privilege.toml +++ b/rules/privilege.toml @@ -30,8 +30,10 @@ pattern = [ suggest = [ ''' #[executable(sudo)] -sudo {{command}}''', +sudo {{command}} +''', ''' #[executable(doas)] -doas {{command}}''', +doas {{command}} +''', ] diff --git a/rules/rm.toml b/rules/rm.toml index 494a293..be82350 100644 --- a/rules/rm.toml +++ b/rules/rm.toml @@ -3,12 +3,16 @@ command = "rm" [[match_err]] pattern = [ "is a directory", ] suggest = [ -'''{{command}} --recursive''' +''' +{{command}} --recursive +''' ] [[match_err]] pattern = [ "no such file or directory", ] suggest = [ -'''{{command[0}} {{opt::(?:\s)-[\w]+}} {{typo[-1](file)}}''' +''' +{{command[0}} {{opt::(?:\s)-[\w]+}} {{typo[-1](file)}} +''' ]