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

[hab,sup] Add UI#progress() method to control progress bar behavior. #1233

Merged
merged 1 commit into from
Sep 14, 2016

Conversation

fnichol
Copy link
Collaborator

@fnichol fnichol commented Sep 14, 2016

This change adds a progress() method on the UI struct to determine
whether or not to display a progress bar on download/upload activities.
The decision is based on whether or not the stdout stream is a terminal
(i.e. an interactive session) meaning that progress bars will be removed
in non-interactive contexts.

Here is an example of the previous behavior (minus coloring which cannot
be reproduced here):

> /src/target/debug/hab install core/jq-static
» Installing core/jq-static
↓ Downloading core/jq-static/1.5/20160730001211
    828.85 KB / 828.85 KB \ [====================================================] 100.00 % 462.36 KB/s
↓ Downloading core-20160612031944 public origin key
    75 B / 75 B | [==============================================================] 100.00 % 824.83 KB/s
☑ Cached core-20160612031944 public origin key
✓ Installed core/jq-static/1.5/20160730001211
★ Install of core/jq-static/1.5/20160730001211 complete with 1 new packages installed.

Finally, here is the same command whose output stream is attached to a
unix pipe:

> /src/target/debug/hab install core/jq-static | cat
» Installing core/jq-static
↓ Downloading core/jq-static/1.5/20160730001211
↓ Downloading core-20160612031944 public origin key
☑ Cached core-20160612031944 public origin key
✓ Installed core/jq-static/1.5/20160730001211
★ Install of core/jq-static/1.5/20160730001211 complete with 1 new packages installed.

Signed-off-by: Fletcher Nichol [email protected]

@thesentinels
Copy link
Contributor

@fnichol, thanks for your PR! By analyzing the annotation information on this pull request, we identified @metadave, @reset, @nsdavidson, @seth and @juliandunn to be potential reviewers

@reset
Copy link
Collaborator

reset commented Sep 14, 2016

gif-keyboard-16976775952423566622

@fnichol
Copy link
Collaborator Author

fnichol commented Sep 14, 2016

Well, how about that? CI FTW--looks like I missed the director

gif-keyboard-6861993739100659427

This change adds a `progress()` method on the `UI` struct to determine
whether or not to display a progress bar on download/upload activities.
The decision is based on whether or not the stdout stream is a terminal
(i.e. an interactive session) meaning that progress bars will be removed
in non-interactive contexts.

Here is an example of the previous behavior (minus coloring which cannot
be reproduced here):

```
> /src/target/debug/hab install core/jq-static
» Installing core/jq-static
↓ Downloading core/jq-static/1.5/20160730001211
    828.85 KB / 828.85 KB \ [====================================================] 100.00 % 462.36 KB/s
↓ Downloading core-20160612031944 public origin key
    75 B / 75 B | [==============================================================] 100.00 % 824.83 KB/s
☑ Cached core-20160612031944 public origin key
✓ Installed core/jq-static/1.5/20160730001211
★ Install of core/jq-static/1.5/20160730001211 complete with 1 new packages installed.
```

Finally, here is the same command whose output stream is attached to a
unix pipe:

```
> /src/target/debug/hab install core/jq-static | cat
» Installing core/jq-static
↓ Downloading core/jq-static/1.5/20160730001211
↓ Downloading core-20160612031944 public origin key
☑ Cached core-20160612031944 public origin key
✓ Installed core/jq-static/1.5/20160730001211
★ Install of core/jq-static/1.5/20160730001211 complete with 1 new packages installed.
```

Signed-off-by: Fletcher Nichol <[email protected]>
@fnichol fnichol force-pushed the fnichol/interactive-progress-bar branch from 1097ec6 to 6a605a5 Compare September 14, 2016 19:19
@reset reset merged commit 8a00092 into master Sep 14, 2016
@reset reset deleted the fnichol/interactive-progress-bar branch September 14, 2016 19:39
@chetan chetan mentioned this pull request Sep 25, 2016
@eeyun eeyun added C-feature and removed Feature labels Jun 6, 2017
@christophermaier christophermaier added Type: Feature Issues that describe a new desired feature and removed C-feature labels Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Issues that describe a new desired feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants