From 1ab0c91e51d5753576a2799180dfc0f66b386a4b Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Mon, 17 Jun 2024 12:46:17 +0900 Subject: [PATCH] cli: inline labeling of trackable remote branches hints This makes it clear that these hints are printed only if status output is enabled. --- cli/src/cli_util.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/cli/src/cli_util.rs b/cli/src/cli_util.rs index 72af109d3..b53d7758b 100644 --- a/cli/src/cli_util.rs +++ b/cli/src/cli_util.rs @@ -1993,21 +1993,17 @@ pub fn print_trackable_remote_branches(ui: &Ui, view: &View) -> io::Result<()> { return Ok(()); } - if let Some(mut writer) = ui.hint_default() { + if let Some(mut formatter) = ui.status_formatter() { writeln!( - writer, + formatter.labeled("hint").with_heading("Hint: "), "The following remote branches aren't associated with the existing local branches:" )?; - } - if let Some(mut formatter) = ui.status_formatter() { for full_name in &remote_branch_names { write!(formatter, " ")?; writeln!(formatter.labeled("branch"), "{full_name}")?; } - } - if let Some(mut writer) = ui.hint_default() { writeln!( - writer, + formatter.labeled("hint").with_heading("Hint: "), "Run `jj branch track {names}` to keep local branches updated on future pulls.", names = remote_branch_names.join(" "), )?;