-
Notifications
You must be signed in to change notification settings - Fork 11
[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
base: main
Are you sure you want to change the base?
Conversation
…) to the pull request, no need to html encode messages anymore
return "", false, fmt.Errorf("error creating request: %w", err) | ||
} | ||
req.Header.Set("Content-Type", "application/json") | ||
req.Header.Set("Accept", "application/json") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
// 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 | ||
} |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
.
No description provided.