plugins icon indicating copy to clipboard operation
plugins copied to clipboard

more info mount drives

Open trapalleiro-git opened this issue 11 months ago • 2 comments

yazi --debug output

nothing

Please describe the problem you're trying to solve

nothing

Would you be willing to contribute this feature?

  • [ ] Yes, I'll give it a shot

Describe the solution you'd like

.... function M:redraw() local rows = {} for _, p in ipairs(self.partitions or {}) do if p.sub == "" then rows[#rows + 1] = ui.Row { p.main } else rows[#rows + 1] = ui.Row { string.format(" %s", p.sub), p.label or "", p.dist or "", p.fstype or "", string.format("%4s", p["fsuse%"] or ""), string.format("%8s", p.fsavail or "") } end end

return {
	ui.Clear(self._area),
	ui.Border(ui.Border.ALL)
		:area(self._area)
		:type(ui.Border.ROUNDED)
		:style(ui.Style():fg("blue"))
		:title(ui.Line(" Mount "):align(ui.Line.CENTER)),
	ui.Table(rows)
		:area(self._area:pad(ui.Pad(4, 8, 4, 8)))
		:header(ui.Row({ "Source", "Label", "Path", "Type", "Used", "Available" }):style(ui.Style():bold():fg("magenta")))
		:row(self.cursor)
		:row_style(ui.Style():fg("blue"):reverse())
		:widths {
			ui.Constraint.Length(20),
			ui.Constraint.Length(20),
			ui.Constraint.Percentage(50),
			ui.Constraint.Length(10),
			ui.Constraint.Length(10),
			ui.Constraint.Length(10),
		},
}

end ...

function M.fillin(tbl) if ya.target_os() ~= "linux" then return tbl end

local sources, indices = {}, {}
for i, p in ipairs(tbl) do
	-- if p.sub ~= "" and not p.fstype then
	if p.sub ~= "" then
		sources[#sources + 1], indices[p.src] = p.src, i
	end
end
if #sources == 0 then
	return tbl
end

local output, err = Command("lsblk"):args({ "-p", "-o", "name,fstype,fsuse%,fsavail" ,"-J" }):args(sources):output()
if err then
	ya.dbg("Failed to fetch filesystem types for unmounted partitions: " .. err)
	return tbl
end

local t = ya.json_decode(output and output.stdout or "")
for _, p in ipairs(t and t.blockdevices or {}) do
	tbl[indices[p.name]].fstype = p.fstype
	tbl[indices[p.name]]["fsuse%"] = p["fsuse%"]
	tbl[indices[p.name]]["fsavail"] = p.fsavail

end

...

Additional context

No response

Checklist

  • [x] I have searched the existing issues/discussions

trapalleiro-git avatar Feb 09 '25 15:02 trapalleiro-git

yazi plugin mount

trapalleiro-git avatar Feb 09 '25 15:02 trapalleiro-git

screenshot:

Image

trapalleiro-git avatar Feb 09 '25 16:02 trapalleiro-git