fix: things with nushell

This commit is contained in:
iff
2025-04-05 01:15:41 +02:00
parent e1e9c14b47
commit 58b6a65a75
6 changed files with 15 additions and 10 deletions

View File

@@ -694,7 +694,7 @@ pub fn get_shell() -> String {
pub fn shell_syntax(shell: &str, command: &str) -> String {
#[allow(clippy::single_match)]
match shell {
"nu" => command.replace("&&", ";").to_string(),
"nu" => command.replace("&&\n", ";\n").to_string(),
_ => command.to_string(),
}
}

View File

@@ -11,7 +11,7 @@ cd {{typo[1](file)}}
''',
'''
#[!shell(nu)]
mkdir --parents {{command[1]}} && \
mkdir --parents {{command[1]}} &&
cd {{command[1]}} '''
]

View File

@@ -16,7 +16,7 @@ pattern = [
suggest = [
'''
#[err_contains(no such file or directory)]
mkdir -p {{cmd::(?m)\s(\S+[\\\/])\S*\s*$}} && \
mkdir -p {{cmd::(?m)\s(\S+[\\\/])\S*\s*$}} &&
{{command[0]}} {{opt::(?:\s)(-[\w]+)}} {{command[1:]}} '''
]

View File

@@ -119,7 +119,7 @@ pattern = [
suggest = [
'''
#[cmd_contains(push)]
git pull && \
git pull &&
{{command}} ''',
'''
#[cmd_contains(push)]
@@ -136,8 +136,8 @@ suggest = [
#[cmd_contains(pull)]
{{command}} --rebase --autostash ''',
'''
git stash && \
{{command}} && \
git stash &&
{{command}} &&
git stash pop '''
]

View File

@@ -7,7 +7,7 @@ pattern = [
]
suggest = [
'''
mkdir --parents {{command[-1]}} && \
mkdir --parents {{command[-1]}} &&
{{command}} '''
]

View File

@@ -4,14 +4,19 @@ command = "touch"
pattern = [ "no such file or directory" ]
suggest = [
'''
mkdir --parents {{cmd::(?:\s)+(.*[\\\/])(?:\s)*}} && \
#[!shell(nu)]
mkdir --parents {{cmd::(?:\s)+(.*[\\\/])(?:\s)*}} &&
touch {{command[1:]}} '''
]
[[match_err]]
pattern = [ "nu::shell::create_not_possible" ]
pattern = [
"nu::shell::create_not_possible",
"no such file or directory",
]
suggest = [
'''
mkdir {{cmd::(?:\s)+(.*[\\\/])(?:\s)*}} and \
#[shell(nu)]
mkdir {{cmd::(?:\s)+(.*[\\\/])(?:\s)*}};
touch {{command[1:]}} '''
]