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

(GH-363) Show human-readable file sizes when downloading #404

Merged
merged 1 commit into from
Sep 15, 2015
Merged

(GH-363) Show human-readable file sizes when downloading #404

merged 1 commit into from
Sep 15, 2015

Conversation

KishanBagaria
Copy link
Contributor

Closes #363

ElseIf ($size -gt 1KB) {[string]::Format("{0:0.00} kB", $size / 1KB)}
ElseIf ($size -gt 0) {[string]::Format("{0:0.00} B", $size)}
Else {""}
}
Copy link
Member

Choose a reason for hiding this comment

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

Does this file require attribution? If you pulled this off of the internet, it will require at the very least linking back to the source.

Copy link
Member

Choose a reason for hiding this comment

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

If not, it should include this header:

# Copyright © 2011 - Present RealDimensions Software, LLC
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# 
# You may obtain a copy of the License at
# 
#   http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

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 stole the function from SO. Instead of getting the attribution right, I rewrote it in a simpler way.

@ferventcoder
Copy link
Member

Thanks for the contribution! If you can see above on fixes I have suggested and fix that up. 👍

@ferventcoder
Copy link
Member

Also your commit message could use a body to help understand what is going on. It can be short, but I would appreciate a little more information about what is being added and why versus the status quo.

I imagine you have already seen the CONTRIBUTING.md guide on formatting your commit messages (as this contribution is already in line with those standards).

When downloading files, show the download progress like 'Saving 8.5 MB of
8.82 MB (8911368/9252864)' instead of 'Saving 8911368 of 9252864'.

Adds Format-FileSize helper function to format the file sizes like
mentioned above.
ferventcoder added a commit that referenced this pull request Sep 15, 2015
(GH-363) Show human-readable file sizes when downloading
@ferventcoder ferventcoder merged commit ee99517 into chocolatey:master Sep 15, 2015
@ferventcoder
Copy link
Member

This will be included in 0.9.10.

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