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

delta git diff #1

Open
pauliesnug opened this issue Jan 10, 2025 · 4 comments
Open

delta git diff #1

pauliesnug opened this issue Jan 10, 2025 · 4 comments

Comments

@pauliesnug
Copy link

  1. how easliy can delta support be added (if its easy and it involves tramsgender i can contribute)
  2. jules is more than just a diff viewer >:(
  • (she is very adorable and awesome)
@NotNite
Copy link
Member

NotNite commented Jan 10, 2025

Should be easy - just have to swap the invocation to difft here:

robojules/src/logic/diff.rs

Lines 201 to 212 in 790fa75

let mut cmd = Command::new("difft");
let cmd = cmd
.arg(old)
.arg(new)
.env("DFT_COLOR", "always")
.env("DFT_WIDTH", width)
.env("DFT_SYNTAX_HIGHLIGHT", "on")
.env("DFT_STRIP_CR", "on");
#[cfg(target_os = "windows")]
let cmd = cmd.creation_flags(super::CREATE_NO_WINDOW);
let stdout = cmd.output().await.context("Failed to run difft")?.stdout;

You'll probably need to implement more colors/codes into the ANSI renderer:

if c == b'm' {
self.draw_text();
let param = params[0][0];
match param {
0 => {
self.current_color = None;
self.underline = false;
}
1 => { /* bold */ }
2 => { /* dimmed */ }
4 => {
self.underline = true;
}
22 => { /* bold */ }
24 => {
self.underline = false;
}
39 => {
self.current_color = None;
}
91 => {
self.current_color = Some(egui::Color32::RED);
}
92 => {
self.current_color = Some(egui::Color32::GREEN);
}
93 => {
self.current_color = Some(egui::Color32::LIGHT_YELLOW);
}
94 => {
self.current_color = Some(egui::Color32::LIGHT_BLUE);
}
95 => {
self.current_color = Some(egui::Color32::LIGHT_RED);
}
96 => {
self.current_color = Some(egui::Color32::BLUE);
}
//_ => unimplemented!("CSI {:?} {:?}", params, intermediates),
_ => {
println!("CSI {:?} {:?}", params, c);
}
}

@NotNite
Copy link
Member

NotNite commented Jan 10, 2025

Also, you might not be able to test this because it relies on an auth token with admin rights for the workflow logs right now... Sorry! I wanted to be able to check the summary output but they have since broke it. I might be able to cook something up to fix this, though.

@NotNite
Copy link
Member

NotNite commented Jan 10, 2025

After revisiting it, I remember the problem now. There are two ways to get the logs:

  • by making a request to github.com/moonlight-mod/extensions/commit/{head_sha}/checks/{job_id}/logs, which requires auth with a browser session
  • by making a request to this API, which claims "Anyone with read access to the repository can use this endpoint", but that's just a lie (you need admin permissions)

Maybe this is a GitHub bug? :(

@NotNite
Copy link
Member

NotNite commented Jan 10, 2025

Nevermind, I was able to reimplement the logic using the changed files in the PR: 344c2cb

Should be easy to test now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants