Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: re-enable the file created attribute #987

Merged
merged 1 commit into from
May 2, 2024

Conversation

rafi
Copy link
Contributor

@rafi rafi commented May 1, 2024

Issue rust-lang/rust#108277 has been resolved and rust-lang/rust#114038 is released with rust 1.78.0 on May 2nd, this revision allows h.cha.created usage, e.g.:

function Status:date()
	local h = cx.active.current.hovered
	if not h then
		return ui.Span('')
	end

	local spans = {}
	local show = {
		modified = { 'm', 'yellow' },
		created  = { 'c', 'green' },
		accessed = { 'a', 'blue' },
	}

	for key, display in pairs(show) do
		if h.cha[key] ~= nil and h.cha[key] then
			local time = ya.round(h.cha[key])
			local ok, fmt = pcall(os.date, '%Y-%m-%d %H:%M', time)
			if ok then
				table.insert(spans, ui.Span(display[1] .. ' '))
				table.insert(spans, ui.Span(fmt .. ' '):fg(display[2]))
			end
		end
	end
	return ui.Line(spans)
end

Copy link
Owner

@sxyazi sxyazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@rafi rafi marked this pull request as ready for review May 1, 2024 15:07
@sxyazi sxyazi changed the title fix: pass file created timestamp feat: re-enable the file created attribute May 2, 2024
@sxyazi sxyazi merged commit a9cf800 into sxyazi:main May 2, 2024
5 checks passed
sxyazi added a commit that referenced this pull request May 2, 2024
sxyazi added a commit that referenced this pull request May 2, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants