Skip to content

Commit 42a3047

Browse files
committed
Avoid printing a note about missing gh
1 parent ca8d940 commit 42a3047

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/bin/josh_sync.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ fn main() -> anyhow::Result<()> {
7070
let sync = GitSync::new(ctx.clone(), josh);
7171
match sync.rustc_pull() {
7272
Ok(result) => {
73-
maybe_create_gh_pr(
73+
if !maybe_create_gh_pr(
7474
&ctx.config.full_repo_name(),
7575
"Rustc pull update",
7676
&result.merge_commit_message,
77-
)?;
77+
)? {
78+
println!(
79+
"Now push the current branch to {} (either a fork or the main repo) and create a PR",
80+
ctx.config.repo
81+
);
82+
}
7883
}
7984
Err(RustcPullError::NothingToPull) => {
8085
eprintln!("Nothing to pull");
@@ -125,13 +130,9 @@ fn load_context(config_path: &Path, rust_version_path: &Path) -> anyhow::Result<
125130
}
126131

127132
fn maybe_create_gh_pr(repo: &str, title: &str, description: &str) -> anyhow::Result<bool> {
128-
let gh_available = which::which("gh").is_ok();
129-
if !gh_available {
130-
println!(
131-
"Note: if you install the `gh` CLI tool, josh-sync will be able to create the sync PR for you."
132-
);
133-
Ok(false)
134-
} else if prompt("Do you want to create a rustc pull PR using the `gh` tool?") {
133+
if which::which("gh").is_ok()
134+
&& prompt("Do you want to create a rustc pull PR using the `gh` tool?")
135+
{
135136
std::process::Command::new("gh")
136137
.args(&[
137138
"pr",

0 commit comments

Comments
 (0)