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

Add nicer status messages when something printed meanwhile #190

Merged
merged 2 commits into from
Jul 11, 2019

Conversation

cserteGT3
Copy link
Contributor

This is again a minor issue, but status messages are not so nice when something is printed between the beginning and the end. Consider the following example:

# no password for the SSH key pair
julia> cleanpull()
→ Retrieving updates from the repository... [done ✔ ]

# setting password for the SSH key pair.

julia> cleanpull()
→ Retrieving updates from the repository...Enter passphrase for key '/c/Users/cstamas/.ssh/ssh_id':
 [done ✔ ]

I think the latter is not so nice, we can do better. In this PR I suggest a solution, which is basically "saving" the beginning of the status, then printing the whole message again, something like:

msg = "git command ..."
print(msg)
run(`git pull`)
println("\r" * msg * "[done]")

Two usecases I encountered:

  • SSH password when git commands run,
  • precompilation info strings.

Git passwords

On master

julia> cleanpull()
→ Retrieving updates from the repository...Enter passphrase for key '/c/Users/cstamas/.ssh/ssh_id':
 [done ✔ ]

julia> publish()
→ Full pass (with pre-rendering)   [done   2.0s]
→ Minifying *.[html|css] files...  [done 778.0ms]
→ Pushing updates with git...      warning: LF will be replaced by CRLF in assets/rundiary/load.jl.
The file will have its original line endings in your working directory
Enter passphrase for key '/c/Users/cstamas/.ssh/id_ed25519':
[done   7.7s]

With this patch

julia> cleanpull()
→ Removing local output dir...      [done ✔ ]
→ Retrieving updates from the repository...Enter passphrase for key '/c/Users/cstamas/.ssh/ssh_id':
→ Retrieving updates from the repository... [done ✔ ]

julia> publish()
→ Full pass (with pre-rendering)   [done   2.6s]
→ Minifying *.[html|css] files...  [done 896.0ms]
→ Pushing updates with git...      warning: LF will be replaced by CRLF in assets/rundiary/load.jl.
The file will have its original line endings in your working directory
Enter passphrase for key '/c/Users/cstamas/.ssh/ssh_id':
→ Pushing updates with git...      [done   5.6s]

Recompilation messages

Tested with an example repo, containing a small script with the ZChop.jl package. (The script is something like: using ZChop; a = zchop(1.000001); println(a).

On master

julia> publish()
→ Full pass (with pre-rendering)   [ Info: Recompiling stale cache file C:\Users\cstamas\.julia\compiled\v1.1\ZChop\cSx6d.ji for ZChop [8603256b-76ad-53fe-b511-38a38e6437cd]
[done   9.2s]
→ Minifying *.[html|css] files...  [done 428.0ms]
→ Pushing updates with git...      warning: LF will be replaced by CRLF in Testike/assets/pages/code/ex2.jl.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in Testike/assets/pages/code/ex3.jl.
...
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in Testike/assets/pages/code/output/ex2.out.
Enter passphrase for key '/c/Users/cstamas/.ssh/ssh_id':
[done   7.9s]

With this patch

julia> publish()
→ Full pass (with pre-rendering)   [ Info: Recompiling stale cache file C:\Users\cstamas\.julia\compiled\v1.1\ZChop\cSx6d.ji for ZChop [8603256b-76ad-53fe-b511-38a38e6437cd]
→ Full pass (with pre-rendering)   [done   8.1s]
→ Minifying *.[html|css] files...  [done 405.0ms]
→ Pushing updates with git...      warning: LF will be replaced by CRLF in Testike/assets/pages/code/ex2.jl.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in Testike/assets/pages/code/ex3.jl.
...
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in Testike/assets/pages/code/output/ex2.out.
Enter passphrase for key '/c/Users/cstamas/.ssh/ssh_id':
→ Pushing updates with git...      [done   6.0s]

I think this way the messages are clearer and nicer, hope you like it too.

@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

Merging #190 into master will decrease coverage by 0.38%.
The diff coverage is 34.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #190      +/-   ##
==========================================
- Coverage   87.51%   87.12%   -0.39%     
==========================================
  Files          26       26              
  Lines        1073     1080       +7     
==========================================
+ Hits          939      941       +2     
- Misses        134      139       +5
Impacted Files Coverage Δ
src/misc_utils.jl 97.29% <100%> (+0.07%) ⬆️
src/manager/judoc.jl 52.85% <25%> (-0.88%) ⬇️
src/manager/post_processing.jl 26.66% <25%> (-1.91%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7010217...c8750f1. Read the comment docs.

@codecov
Copy link

codecov bot commented Jul 11, 2019

Codecov Report

Merging #190 into master will decrease coverage by 0.38%.
The diff coverage is 34.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #190      +/-   ##
==========================================
- Coverage   87.51%   87.12%   -0.39%     
==========================================
  Files          26       26              
  Lines        1073     1080       +7     
==========================================
+ Hits          939      941       +2     
- Misses        134      139       +5
Impacted Files Coverage Δ
src/misc_utils.jl 97.29% <100%> (+0.07%) ⬆️
src/manager/judoc.jl 52.85% <25%> (-0.88%) ⬇️
src/manager/post_processing.jl 26.66% <25%> (-1.91%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7010217...3a519fa. Read the comment docs.

@tlienart
Copy link
Owner

Yep looks good! Maybe change the name printend for print_final which I find a bit more explicit; otherwise I'm happy to merge.

@tlienart tlienart merged commit 9e49323 into tlienart:master Jul 11, 2019
@tlienart tlienart mentioned this pull request Jul 11, 2019
27 tasks
@cserteGT3 cserteGT3 deleted the cst-better-statusmsg branch July 11, 2019 13:00
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