mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
feat: add ya.shell_join() API
This commit is contained in:
parent
715fbf5b65
commit
9e113a9337
1 changed files with 13 additions and 0 deletions
|
|
@ -35,6 +35,19 @@ impl Utils {
|
||||||
lua.create_function(|_, mime: mlua::String| Ok(mime_valid(mime.as_bytes())))?,
|
lua.create_function(|_, mime: mlua::String| Ok(mime_valid(mime.as_bytes())))?,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
ya.set(
|
||||||
|
"shell_join",
|
||||||
|
lua.create_function(|_, table: Table| {
|
||||||
|
let mut s = String::new();
|
||||||
|
for v in table.sequence_values::<mlua::String>() {
|
||||||
|
s.push_str(shell_words::quote(v?.to_str()?).as_ref());
|
||||||
|
s.push(' ');
|
||||||
|
}
|
||||||
|
s.pop();
|
||||||
|
Ok(s)
|
||||||
|
})?,
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue