Skip to content

Commit 55f69fb

Browse files
authored
refactor: deprecate the Command:args() method (#2752)
1 parent ea90b04 commit 55f69fb

File tree

20 files changed

+53
-106
lines changed

20 files changed

+53
-106
lines changed

Cargo.lock

Lines changed: 0 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ globset = "0.4.16"
3434
indexmap = { version = "2.9.0", features = [ "serde" ] }
3535
libc = "0.2.172"
3636
lru = "0.14.0"
37-
md-5 = "0.10.6"
3837
mlua = { version = "0.10.3", features = [ "anyhow", "async", "error-send", "lua54", "macros", "serialize" ] }
3938
objc = "0.2.7"
4039
parking_lot = "0.12.3"

yazi-binding/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ impl UserData for Error {
6666
match (lhs, rhs) {
6767
(Value::String(l), Value::UserData(r)) => {
6868
let r = r.borrow::<Self>()?;
69-
lua.create_string([l.as_bytes().as_ref(), r.to_string().as_bytes()].concat())
69+
lua.create_string([&l.as_bytes(), r.to_string().as_bytes()].concat())
7070
}
7171
(Value::UserData(l), Value::String(r)) => {
7272
let l = l.borrow::<Self>()?;
73-
lua.create_string([l.to_string().as_bytes(), r.as_bytes().as_ref()].concat())
73+
lua.create_string([l.to_string().as_bytes(), &r.as_bytes()].concat())
7474
}
7575
_ => Err("only string can be concatenated with Error".into_lua_err()),
7676
}

yazi-binding/src/url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl UserData for Url {
138138
lua.create_string(me.as_os_str().as_encoded_bytes())
139139
});
140140
methods.add_meta_method(MetaMethod::Concat, |lua, lhs, rhs: mlua::String| {
141-
lua.create_string([lhs.as_os_str().as_encoded_bytes(), rhs.as_bytes().as_ref()].concat())
141+
lua.create_string([lhs.as_os_str().as_encoded_bytes(), &rhs.as_bytes()].concat())
142142
});
143143
}
144144
}

yazi-fm/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![allow(clippy::module_inception, clippy::unit_arg)]
1+
#![allow(clippy::if_same_then_else, clippy::module_inception, clippy::unit_arg)]
22

33
#[cfg(all(not(target_os = "macos"), not(target_os = "windows")))]
44
#[global_allocator]

yazi-plugin/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ base64 = { workspace = true }
3131
crossterm = { workspace = true }
3232
futures = { workspace = true }
3333
globset = { workspace = true }
34-
md-5 = { workspace = true }
3534
mlua = { workspace = true }
3635
parking_lot = { workspace = true }
3736
paste = { workspace = true }

yazi-plugin/preset/plugins/archive.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function M.spawn_7z(args)
4848
local last_err = nil
4949
local try = function(name)
5050
local stdout = args[1] == "l" and Command.PIPED or Command.NULL
51-
local child, err = Command(name):args(args):stdout(stdout):stderr(Command.PIPED):spawn()
51+
local child, err = Command(name):arg(args):stdout(stdout):stderr(Command.PIPED):spawn()
5252
if not child then
5353
last_err = err
5454
end

yazi-plugin/preset/plugins/file.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ local M = {}
22

33
function M:peek(job)
44
local cmd = os.getenv("YAZI_FILE_ONE") or "file"
5-
local output, err = Command(cmd):args({ "-bL", "--", tostring(job.file.url) }):stdout(Command.PIPED):output()
5+
local output, err = Command(cmd):arg({ "-bL", "--", tostring(job.file.url) }):stdout(Command.PIPED):output()
66

77
local text
88
if output then

yazi-plugin/preset/plugins/font.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function M:preload(job)
2727
return true
2828
end
2929

30-
local status, err = Command("magick"):args({
30+
local status, err = Command("magick"):arg({
3131
"-size",
3232
"800x560",
3333
"-gravity",

yazi-plugin/preset/plugins/json.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ local M = {}
22

33
function M:peek(job)
44
local child = Command("jq")
5-
:args({ "-b", "-C", "--tab", ".", tostring(job.file.url) })
5+
:arg({ "-b", "-C", "--tab", ".", tostring(job.file.url) })
66
:stdout(Command.PIPED)
77
:stderr(Command.PIPED)
88
:spawn()

0 commit comments

Comments
 (0)