22 Commits

Author SHA1 Message Date
J Logan caff1e9b42 Improve readability of progress bar width computation. (#1584)
- Refines bugfix from #1547, no functional changes.
2026-05-22 13:03:09 -07:00
Erwan Legrand 831a6bfe1c fix: clamp ProgressBar barLength to non-negative value to avoid crash (#1525)
- Closes #1547.
- A negative progress value (e.g. from a race in progress events) would
produce a negative barLength and crash inside String(repeating:count:).
Wrap the computed length in max(0, ...) and add a regression test that
calls set(size: -10) and exercises draw(state:detail:).
2026-05-21 19:11:28 -07:00
Nikunj Thakur 1c37384831 Add Color Progress Output Mode (#1384)
- Adds a color progress output mode (`--progress color`)
  that renders ANSI-colored progress output with visual
  differentiation between progress states.
- Like `ansi` mode, this feature requires a TTY.
- Closes #1366
2026-04-10 09:19:16 -07:00
Manoj Mahapatra ce77361057 doc: Document plain clear-on finish behavior (#1379)
- Clarified the `.plain` progress contract. This also
  documents how `clearOnFinish` interacts with plain
  output. Added test coverage for the current behavior.
2026-04-02 13:05:52 -07:00
Nikunj Thakur 745134540e Add Plain Progress Output Mode (#1367)
- Adds a `plain` progress output mode (`--progress plain`)
  that outputs newline-separated progress lines without
  ANSI escape sequences. This is useful for CI environments,
  piped output, and non-TTY contexts where ANSI cursor
  control is not supported. Unlike `--progress ansi`, plain
  mode works even when stderr is not a TTY.
- Closes #1365
- Related: #641, #808
2026-04-01 18:24:39 -07:00
Dmitry Kovba 4a08bb0daa Ensure that the bar length never exceeds the remaining width (#1348)
- Fixes a reported problem, caused by a race in
  progress events from the Containerization package
  reaching container.
2026-03-30 12:22:58 -07:00
Danny Canter b671690c17 ProgressBar: Various fixes (#1025)
There's a couple things I don't think are intuitive about this.

1. Because of the internal task, render() can still be called even after
finish() completes. Ideally async defers are supported and we could just
await the final render completing after cancelling the task and setting
.finished, but alas. To fix this we can just lock across the methods for
now.
2. We always clear the screen in the destructor, even if we don't use
the
progress bar. I don't think we should honestly do anything in the
destructor.
Feels a programmer error not to defer { bar.finish() } or call it
somewhere.
3. Our spaces based line clearing. Use the ansi escape sequence for
clearing line;
I think our calculations were slightly off and it would leave trailing
output ( "s]" )
in some cases.
4. Shrinking the window until the output is smaller than the terminal
window (and vice
versa) is wonky on various term emulators. Truthfully, this is just a
hard problem,
but we can truncate our output and still provide some useful info.

This fixes some single line output (cat /etc/hostname etc.) getting
cleared in our atexit handler, as well as the need for the usleep.
2026-01-07 21:01:10 -08:00
Kathryn Baldauf d6f052d206 Update license header on all files to include the current year (#1024)
## Motivation and Context
Now that we're in 2026, we need to update the license headers on all the
files. Unfortunately, Hawkeye doesn't have an attribute for the current
year to help us avoid this in the future. Instead, I had to work around
this by doing the following:

1. Update licenserc.toml with:
     ```
      [properties]
       ... (other properties)
       currentYear = "2026"
     ```
 
2. Update scripts/license-header.txt with
    ```
Copyright ©{{ " " }}{%- set created = attrs.git_file_created_year or
attrs.disk_file_created_year -%}{%- set modified = props["currentYear"]
-%}{%- if created != modified -%} {{created}}-{{modified}}{%- else
-%}{{created}}{%- endif -%}{{ " " }}{{ props["copyrightOwner"] }}.
    ```

Then I removed these two changes before committing. After this PR is
merged, all files will have recently had git updates, so the existing
code for setting the modified year should work as intended.

Signed-off-by: Kathryn Baldauf <k_baldauf@apple.com>
2026-01-05 13:09:34 -08:00
Dmitry Kovba 38960553cb Lowercase error messages (#945)
## Type of Change
- [x] Bug fix
- [ ] New feature  
- [ ] Breaking change
- [ ] Documentation update

## Motivation and Context
For consistency, all error messages are lowercased.

## Testing
- [ ] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs

---------

Co-authored-by: J Logan <sgtbakerrahulnet@yahoo.com>
2025-12-09 12:32:28 -08:00
TTtie ab92f3938e fix(TerminalProgress): make the progress bar respect locale-specific decimal separator (#936)
- The `ProgressBar#adjustFormattedSize` function currently expects a
  decimal dot when adding the additional ".0" to the size. This, however,
  breaks when a region with a non-dot decimal separator is used.
2025-12-08 14:17:10 -03:00
J Logan bfc5ca9222 Removes "all rights reserved" from license header. (#711)
Closes #63.
2025-10-03 13:28:16 -07:00
Dmitry Kovba e7da2d59f1 Do not print task descriptions with disabled progress updates (#444)
Fully resolves https://github.com/apple/container/issues/396.
2025-08-05 12:29:26 -07:00
Dmitry Kovba 9e9d056339 Transition to Mutex (#364)
Due to the reduced use of the macro, we can now fully transition to
`Mutex`.
2025-07-31 13:36:18 -07:00
Dmitry Kovba c41a8883ea Use Mutex for thread-safe access to structs (#325)
Changes in this PR prevent a race caused by an implicit call to a
computed property getter when updating the property value.
2025-07-14 15:23:35 -07:00
Dmitry Kovba 0535d36929 Fix warnings in make docs (#220) 2025-06-16 17:55:48 -07:00
Josh Soref 4a4ad40d74 Spelling (#207)
This PR corrects misspellings identified by the [check-spelling
action](https://github.com/marketplace/actions/check-spelling)

The misspellings have been reported at
https://github.com/jsoref/container/actions/runs/15662939575/attempts/1
The action reports that the changes in this PR would make it happy:
https://github.com/jsoref/container/actions/runs/15662939742/attempts/1#summary-44123289718

---------

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-06-16 10:49:03 -07:00
Patrick Stöckle 84edaa20db Fix typos (#122)
Hi there,

some small typos I fixed using
[`typos`](https://github.com/crate-ci/typos).

Cheers,
Patrick
2025-06-13 11:07:07 -07:00
Dmitry Kovba 206f3cc07c Improve accuracy of progress updates (#144)
This PR resolves the problem of dropped progress updates and ensures the
accuracy of the information provided in the progress bar. Additionally,
it adds the displaying of the finished state to the progress bar.
Requires merging and tagging
https://github.com/apple/containerization/pull/91.
2025-06-12 23:36:38 -07:00
Ümit DEMİRCİ c114945f15 fix: typo (#153) 2025-06-12 17:14:15 -07:00
Dmitry Kovba 8ad99efdbc Allow printed output to flush to prevent a race between progress updates and other output (#23)
This PR also improves clearing the last progress update after moving to
a new task using `setDescription()`.
2025-06-06 11:48:22 -07:00
Dmitry Kovba 27df947172 Clear a line with spaces to prevent a race between stderr and stdout (#18)
This PR resolves a race with `\u{001B}[2K`, but not with `\r`, which
will be addressed in a separate PR by moving progress updates to
`stdout`. Please test it in a small window in your terminal application
on the `users/a_ramani/install-ux` branch using commands:
```
bin/container system stop
make cleancontent
bin/container system start
```
You should see the prompt:
> Install the recommended default kernel from
[https://github.com/kata-containers/kata-containers/releases/download/3.17.0/kata-static-3.17.0-arm64.tar.xz]?
[Y/n]:
2025-06-05 15:53:45 -07:00
Kathryn Baldauf 8e9670c8f8 Initial commit
Co-authored-by: Aditya Ramani <a_ramani@apple.com>
Co-authored-by: Agam Dua <agam_dua@apple.com>
Co-authored-by: Danny Canter <danny_canter@apple.com>
Co-authored-by: Dmitry Kovba <dkovba@apple.com>
Co-authored-by: Eric Ernst <eric_ernst@apple.com>
Co-authored-by: Evan Hazlett <ehazlett@apple.com>
Co-authored-by: Gilbert Song <gilbertsong@apple.com>
Co-authored-by: Hugh Bussell <hbussell@apple.com>
Co-authored-by: John Logan <john_logan@apple.com>
Co-authored-by: Kathryn Baldauf <k_baldauf@apple.com>
Co-authored-by: Madhu Venugopal <mvenugopal@apple.com>
Co-authored-by: Michael Crosby <michael_crosby@apple.com>
Co-authored-by: Sidhartha Mani <sidhartha_mani@apple.com>
Co-authored-by: Tanweer Noor <tnoor@apple.com>
Co-authored-by: Ximena Perez Diaz <xperez528@gmail.com>
Co-authored-by: Yibo Zhuang <yzhuang@apple.com>
2025-06-05 15:51:55 -07:00