Skip to content

Review suggestions#1

Merged
maximillianfx merged 1 commit intomaximillianfx:2564-add-spinner-loadingfrom
thaJeztah:cp_spinner_review_comments
Feb 22, 2021
Merged

Review suggestions#1
maximillianfx merged 1 commit intomaximillianfx:2564-add-spinner-loadingfrom
thaJeztah:cp_spinner_review_comments

Conversation

@thaJeztah
Copy link
Copy Markdown

Opening my branch with suggested changes as a pull-request (see docker#2708 (review))

  • remove fields from cpWithProgress that were not used
  • only wrap cpWithProgress when printing progress
  • rename cpWithProgress to copyProgressReader
  • use aec for terminal control sequences
  • print progress to STDERR instead of STDOUT
  • don't use terminal detection to set the default, and instead perform
    it if no value was set. This prevents confusion when doing, e.g.:
    docker cp --help | grep ...
  • return early if "quiet", to simplify multiple "if" statements

}

fmt.Fprint(dockerCli.Err(), "Preparing to copy...\n")
fmt.Fprint(dockerCli.Err(), "\033[s")
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This should probably be replaced with a aec.XX. I wasn't sure what code this was ☺️

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This cursor command (\033[s) saves the cursor position, in this case, the beginning the new line.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think that aec.save() could solve this.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hello @thaJeztah, how are you? Did you see this change in this line?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

oh! missed it (or thought you would include it in after this was merged); let me update

@maximillianfx
Copy link
Copy Markdown
Owner

First of all, thanks for your comments and PR. I'll check all the points.

Copy link
Copy Markdown
Owner

@maximillianfx maximillianfx left a comment

Choose a reason for hiding this comment

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

Good points, I've made some observations and questions, thanks!

}

fmt.Fprint(dockerCli.Err(), "Preparing to copy...\n")
fmt.Fprint(dockerCli.Err(), "\033[s")
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This cursor command (\033[s) saves the cursor position, in this case, the beginning the new line.

- remove fields from cpWithProgress that were not used
- only wrap cpWithProgress when printing progress
- rename cpWithProgress to copyProgressReader
- use aec for terminal control sequences
- print progress to STDERR instead of STDOUT
- don't use terminal detection to set the default, and instead perform
  it if no value was set. This prevents confusion when doing, e.g.:
    docker cp --help | grep ...
- return early if "quiet", to simplify multiple "if" statements

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the cp_spinner_review_comments branch from f8e1f92 to fb38ac4 Compare February 22, 2021 18:19
@thaJeztah
Copy link
Copy Markdown
Author

@maximillianfx updated; PTAL

@maximillianfx
Copy link
Copy Markdown
Owner

maximillianfx commented Feb 22, 2021

LGTM, I'll made some tests here to see if breaks something.

@maximillianfx maximillianfx merged commit 7a70bd4 into maximillianfx:2564-add-spinner-loading Feb 22, 2021
@thaJeztah thaJeztah deleted the cp_spinner_review_comments branch February 22, 2021 18:54
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