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 progress bar #2309

Merged
merged 4 commits into from May 11, 2019

Conversation

3 participants
@ry
Copy link
Collaborator

commented May 8, 2019

No description provided.

@ry ry force-pushed the ry:progress2 branch from 63965c9 to a6e01ef May 8, 2019

@ry ry requested a review from piscisaureus May 8, 2019

@bartlomieju

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

@ry a little suggestion from me: can progress bar be disabled after initial boot?

Once we support import() and Deno.deps("...") it's not desired to have additional Downloading/Compiling messages when any of them is used.

Ref comment

@ry

This comment has been minimized.

Copy link
Collaborator Author

commented May 9, 2019

@bartlomieju I'm not sure about that... I would expect that if I import() something it would display some messages about what it's doing. That said, having a way to disable the progress bar would be useful as it would fix the TODO I have in main.rs.

@bartlomieju

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

@ry after second thoughts you're probably right. Re disabling of progress bar, maybe it could be handled by progress.unset_callback?

  pub fn unset_callback(&self)  {
    let mut s = self.0.lock().unwrap();
    assert!(s.callback.is_some());
    s.callback = None;
  }
@bartlomieju

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

@ry regarding a TODO from main.rs, you can resolve it like that:

progress.set_callback(|completed, total, msg| {
    eprint!("\x1B[K"); // Clear to end of line.
    eprint!("[{}/{}] {}\r", completed, total, msg);

    if completed == total {
      println!();
    }
  });
19:20 $ deno_dev run -r foo.ts
[58/58] Compiling file:///Users/biwanczuk/dev/deno/foo.ts
foobar!
@ry

This comment has been minimized.

Copy link
Collaborator Author

commented May 9, 2019

@bartlomieju I tried that at first, but learned that completed == total doesn't necessarily mean it's done.

@ry ry force-pushed the ry:progress2 branch from a6e01ef to 561391d May 9, 2019

@bartlomieju

This comment has been minimized.

Copy link
Contributor

commented May 9, 2019

How about Inner.done_callback and Progress.done?

Taking into account two cases I presented before there would be 3 places to signal process bar that everything has been downloaded and compiled, and done_callback would only print new line. OTOH when I think of dynamic imports I can imagine a situation that progress bar showing dynamic import downloads would somehow overlap with user script output.

ry added some commits May 10, 2019

@ry

This comment has been minimized.

Copy link
Collaborator Author

commented May 11, 2019

@bartlomieju As you suggested, I've added Progress::done()

@piscisaureus
Copy link
Collaborator

left a comment

Looking good with a few remarks. I'll approve it like this, but please respond to comments.

Show resolved Hide resolved cli/compiler.rs
@@ -682,7 +688,10 @@ fn fetch_remote_source_async(
}
})
},
)
).then(move |r| {
drop(download_job);

This comment has been minimized.

Copy link
@piscisaureus

piscisaureus May 11, 2019

Collaborator

Same here. What is this drop() thing needed for?

Show resolved Hide resolved cli/progress.rs

@ry ry merged commit aba9523 into denoland:master May 11, 2019

3 checks passed

Travis CI - Pull Request Build Passed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
license/cla Contributor License Agreement is signed.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.