Rename parameter and use cmd in aliases

This commit is contained in:
Jason Shirk 2020-05-05 22:48:24 -07:00
parent c7ab4277df
commit e58442cef2
2 changed files with 14 additions and 14 deletions

View File

@ -13,7 +13,7 @@ pub const CONFIG: ShellConfig = ShellConfig {
}, },
}; };
fn z(z_cmd: &str) -> String { fn z(cmd: &str) -> String {
format!( format!(
r#" r#"
function _z_cd function _z_cd
@ -52,11 +52,11 @@ function {}
end end
end end
"#, "#,
z_cmd cmd
) )
} }
fn alias(z_cmd: &str) -> String { fn alias(cmd: &str) -> String {
format!( format!(
r#" r#"
abbr -a {0}i '{0} -i' abbr -a {0}i '{0} -i'
@ -69,7 +69,7 @@ abbr -a {0}qi 'zoxide query -i'
abbr -a {0}r 'zoxide remove' abbr -a {0}r 'zoxide remove'
abbr -a {0}ri 'zoxide remove -i' abbr -a {0}ri 'zoxide remove -i'
"#, "#,
z_cmd cmd
) )
} }

View File

@ -13,7 +13,7 @@ pub const CONFIG: ShellConfig = ShellConfig {
}, },
}; };
fn z(z_cmd: &str) -> String { fn z(cmd: &str) -> String {
format!( format!(
r#" r#"
function {} {{ function {} {{
@ -43,24 +43,24 @@ function {} {{
}} }}
}} }}
"#, "#,
z_cmd cmd
) )
} }
fn alias(z_cmd: &str) -> String { fn alias(cmd: &str) -> String {
format!( format!(
r#" r#"
function zi {{ {} -i @args }} function {0}i {{ {0} -i @args }}
function za {{ zoxide add @args }} function {0}a {{ zoxide add @args }}
function zq {{ zoxide query @args }} function {0}q {{ zoxide query @args }}
function zqi {{ zoxide query -i @args }} function {0}qi {{ zoxide query -i @args }}
function zr {{ zoxide remove @args }} function {0}r {{ zoxide remove @args }}
function zri {{ zoxide remove -i @args }} function {0}ri {{ zoxide remove -i @args }}
"#, "#,
z_cmd cmd
) )
} }