ggrossetie / asciidoctor-web-pdf

Convert AsciiDoc documents to PDF using web technologies
https://asciidoctor.org
MIT License
448 stars 92 forks source link

multi-lined download status #490

Closed wh81752 closed 3 years ago

wh81752 commented 3 years ago

A PR for getting a multi-line download status: Expect to see something like this on downloading Chromium for supported platforms:

Create directory structure
========
Downloading browser for mac      16%
Downloading browser for win      11%
Downloading browser for linux     7%
========
wh81752 commented 3 years ago

@Mogztter - it basically works, still some fine tuning necessary => move cursor after download status-lines when finished OR -- perhaps better -- change PRE/POST condition in such a way, that cursor is at line after multi-line area. So that further logs to come will not overwrite status-line area. Nonetheless, it basically works.

wh81752 commented 3 years ago

Just a minor, while important, improvement:

Create directory structure
===========================
Downloading browser for mac      16%
Downloading browser for win      11%
Downloading browser for linux     7%
===========================
^

TTY cursor is now a position indicated by caret (^) after each status line update. Whatever happens then, this modification ensures that follow-up log statements within the TTY are not overwriting the update-status block. One notable exception though would is of course kill -9, i.e. process killing.

wh81752 commented 3 years ago

@Mogztter - this PR supersedes #488, however, there is no dependency on #488. So we can drop #488 in favor of this one.

ggrossetie commented 3 years ago

Thanks, I will give it a try on my macOS laptop 🍎

ggrossetie commented 3 years ago

It's working great but using a single line is probably less confusing (especially if you press in the terminal):

Downloading browser [mac:  1%]
Downloading browsers [linux:  1%, mac:  1%, win:  1%]

Please review: https://github.com/wh81752/asciidoctor-web-pdf/pull/1

wh81752 commented 3 years ago

@Mogztter - proper single-line download status now, I guess ready to be merged with master.

Btw, I wonder what the best GIT strategy now is. My approach would be:

  1. rebase this branch on master (i.e. change git history is such a way as if this branch has been taken from current master), resolving potential merge conflicts while doing so.
  2. Squash commit on this branch into one commit
  3. merge (done by you)

Is that the right way to do?

ggrossetie commented 3 years ago

@wh81752 Yes, you can use an interactive rebase: git rebase -i origin/master (in this case, origin is https://github.com/Mogztter/asciidoctor-web-pdf) to squash all commits. You can also reword the first commit (while doing the rebase) to accurately describe what you did. Then, force push on your branch. You need to force push because commits have changed.

If all goes well, you will have a pull request with a single commit.

wh81752 commented 3 years ago

@Mogztter - here we go, ready to merge.###

ggrossetie commented 3 years ago

Thanks and merged!