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

tqdm: add examples #15751

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

tqdm: add examples #15751

wants to merge 1 commit into from

Conversation

BuonOmo
Copy link
Contributor

@BuonOmo BuonOmo commented Feb 18, 2025

  • The page(s) are in the correct platform directories: common, linux, osx, windows, sunos, android, etc.
  • The page(s) have at most 8 examples.
  • The page description(s) have links to documentation or a homepage.
  • The page(s) follow the content guidelines.
  • The page(s) follow the style guide.
  • The PR title conforms to the recommended templates.
  • Version of the command being documented (if known): v4.67.1

@github-actions github-actions bot added page edit Changes to an existing page(s). review needed Prioritized PRs marked for reviews from maintainers. labels Feb 18, 2025
@tldr-bot
Copy link

The build for this PR failed with the following error(s):

pages/common/tqdm.md:
Error: Parse error on line 16:
...dm --bytes --total `du -sb {{{docs/}} | 
-----------------------^
Expecting 'NEWLINE', 'TEXT', 'DASH', 'BACKTICK', got 'COMMAND_TEXT'
pages/common/tqdm.md:15: TLDR021 Command example should not begin or end in whitespace

Please fix the error(s) and push again.

@BuonOmo BuonOmo force-pushed the tqdm branch 2 times, most recently from 7d19cdc to faca4b0 Compare February 18, 2025 16:02
> More information: <https://tqdm.github.io/>.

- Show iterations per second and use stdout afterwards:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Show iterations per second and use stdout afterwards:
- Show iterations per second and use `stdout` afterwards:


- Specify unit and total:

`tar -zcf - {{docs/}} | tqdm --bytes --total $(du -sb {{docs/}} | cut -f1) > {{backup.tgz}}`
Copy link
Member

Choose a reason for hiding this comment

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

This example doesn't work very well. The du command will output the size of the docs directory, but the size of a gzip-compressed tarball will be smaller than that, and so the progress bar will stop when it reaches the size of the compressed archive instead of 100%.

Here's the final output after compressing some files:

93%|██████████████████████████████▉           | 33.1M/35.4M [00:01<00:00, 31.1MB/s]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would you prefer that one ? Also taken from the docs.

7z a -bd -r backup.7z docs/ | grep Compressing | \
    tqdm --total $(find docs/ -type f | wc -l) --unit files >> backup.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
page edit Changes to an existing page(s). review needed Prioritized PRs marked for reviews from maintainers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants