Skip to content

[WIP] Pull progress per layer #74

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Conversation

ilopezluna
Copy link
Contributor

No description provided.

return "", false, fmt.Errorf("error creating request: %w", err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Accept", "application/json")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not using doRequest because I need to add the header eq.Header.Set("Accept", "application/json")
Would it be better to update doRequest to allow add headers?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say go for it - either adding a headers argument, or maybe an optional callback to modify the prepared request before it's transmitted. headers might be simpler.

if pt.lastLines > 0 {
// Move cursor up and clear lines
for i := 0; i < pt.lastLines; i++ {
fmt.Print("\033[A\033[K")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know if this will be portable to cmd.exe-based shells.

Comment on lines +163 to +171
// getTerminalWidth returns the terminal width, or 80 as default
func getTerminalWidth() int {
width, _, err := term.GetSize(int(os.Stdout.Fd()))
if err != nil {
// Default to 80 columns if we can't detect terminal size
return 80
}
return width
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would also double check this function with cmd.exe. Even if it defaults to 80, sometimes cmd.exe will loop output at 1 character before the width. But I'm also not sure if that's true if the terminal is put into raw mode.

} else {
// Fallback: use simple progress display for backward compatibility
// Clear the line and show the progress message
fmt.Print("\r\033[K", msg.Message)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question re: cmd.exe.

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

Successfully merging this pull request may close these issues.

2 participants