-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed as not planned
Labels
A-console-outputArea: Terminal output, colors, progress bar, etc.Area: Terminal output, colors, progress bar, etc.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Description
Currently, cargo
only outputs "Compiling xxx" when starting a job. I propose using ANSI control sequences to have a more finer progress report while keeping the same number of line output.
PoC with jobs in WiP or done state:
#!/usr/bin/env bash
a=(10 4 3 2 5 7 8 1 6 9)
for i in $(seq 1 10); do
echo "doing $i"
done
for i in $(seq 1 10); do
# \033[nA moves the cursor up n lines
printf "\033[$((11 - i))A"
# Print done jobs. \033[K clears the current line
printf "\033[Kdone $i\n"
# Print jobs still running
for x in "${a[@]}"; do
if [[ $x -gt $i ]]; then
printf "\033[Kdoing $x\n"
fi
done
sleep 1
done
The basic idea is with n jobs running, when a job finishes we erase the n previous lines, print the finished jobs then print the jobs still working.
When this setup is working, we can expand it to show a more finer progress report for each job.
Windows seems to support it, MacOS and Linux does.
See #833, maybe also others.
Metadata
Metadata
Assignees
Labels
A-console-outputArea: Terminal output, colors, progress bar, etc.Area: Terminal output, colors, progress bar, etc.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`