run::BuildManifest,
run::BumpStage0,
run::ReplaceVersionPlaceholder,
+ run::Miri,
),
// These commands either don't use paths, or they're special-cased in Build::build()
Kind::Clean | Kind::Format | Kind::Setup => vec![],
Subcommand::Bench { ref paths, .. } => (Kind::Bench, &paths[..]),
Subcommand::Dist { ref paths } => (Kind::Dist, &paths[..]),
Subcommand::Install { ref paths } => (Kind::Install, &paths[..]),
- Subcommand::Run { ref paths } => (Kind::Run, &paths[..]),
+ Subcommand::Run { ref paths, .. } => (Kind::Run, &paths[..]),
Subcommand::Format { .. } => (Kind::Format, &[][..]),
Subcommand::Clean { .. } | Subcommand::Setup { .. } => {
panic!()
false
}
+
+ pub(crate) fn maybe_open_in_browser<S: Step>(&self, path: impl AsRef<Path>) {
+ if self.was_invoked_explicitly::<S>(Kind::Doc) {
+ self.open_in_browser(path);
+ }
+ }
+
+ pub(crate) fn open_in_browser(&self, path: impl AsRef<Path>) {
+ if self.config.dry_run || !self.config.cmd.open() {
+ return;
+ }
+
+ let path = path.as_ref();
+ self.info(&format!("Opening doc {}", path.display()));
+ if let Err(err) = opener::open(path) {
+ self.info(&format!("{}\n", err));
+ }
+ }
}
#[cfg(test)]