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

Add a progress bar for file copying. #457

Merged
merged 1 commit into from
Jul 20, 2024

Conversation

stvnrhodes
Copy link
Contributor

This uses https://pkg.go.dev/github.com/schollz/progressbar/v3 in the most basic way. Copying larger files can get very confusing without feedback because it can be unclear on how much progress has been made, whether progress is ongoing, and how long until the command will be complete. A progress bar helps a lot for understandability.

File copying is currently implemented by synchronously sending bytes to be copied to all targets, so a single progress bar is sufficient for tracking progress across all targets.

Example of how this looks mid-run:

$ go run ./cmd/sanssh -targets localhost file cp  -username stvn -group stvn -mode 0755 ./cmd/sansshell-server/sansshell-server /tmp/s
  52% |█████████████████████████████████████████████████████████████                                             | (38/72 MB, 1.6 MB/s) [26s:22s]

I've put in a "is directory" check too because the previous code confusingly hung indefinitely when asked to copy a directory.

This uses https://pkg.go.dev/github.com/schollz/progressbar/v3 in the most basic way. Copying larger files can get very confusing without feedback because it can be unclear on how much progress has been made, whether progress is ongoing, and how long until the command will be complete. A progress bar helps a lot for understandability.

File copying is currently implemented by synchronously sending bytes to be copied to all targets, so a single progress bar is sufficient for tracking progress across all targets.

Example of how this looks mid-run:
```
❯ go run ./cmd/sanssh -targets localhost file cp  -username stvn -group stvn -mode 0755 ./cmd/sansshell-server/sansshell-server /tmp/s
  52% |██████████████████████████████████████████████████████████████████████████████████████                                                                                 | (38/72 MB, 1.6 MB/s) [26s:22s]
```
@stvnrhodes stvnrhodes marked this pull request as ready for review July 18, 2024 15:04
@sfc-gh-srhodes sfc-gh-srhodes merged commit 0938236 into Snowflake-Labs:main Jul 20, 2024
5 checks passed
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.

3 participants