forked from mirrors/jj
cli: colorize choices of prev/next commits
This commit is contained in:
parent
d168fd2b09
commit
566713bf6b
1 changed files with 6 additions and 7 deletions
|
@ -70,18 +70,17 @@ pub fn choose_commit<'a>(
|
|||
commits: &'a [Commit],
|
||||
) -> Result<&'a Commit, CommandError> {
|
||||
writeln!(ui.stdout(), "ambiguous {cmd} commit, choose one to target:")?;
|
||||
let mut formatter = ui.stdout_formatter();
|
||||
let mut choices: Vec<String> = Default::default();
|
||||
for (i, commit) in commits.iter().enumerate() {
|
||||
writeln!(
|
||||
ui.stdout(),
|
||||
"{}: {}",
|
||||
i + 1,
|
||||
workspace_command.format_commit_summary(commit)
|
||||
)?;
|
||||
write!(formatter, "{}: ", i + 1)?;
|
||||
workspace_command.write_commit_summary(formatter.as_mut(), commit)?;
|
||||
writeln!(formatter)?;
|
||||
choices.push(format!("{}", i + 1));
|
||||
}
|
||||
writeln!(ui.stdout(), "q: quit the prompt")?;
|
||||
writeln!(formatter, "q: quit the prompt")?;
|
||||
choices.push("q".to_string());
|
||||
drop(formatter);
|
||||
|
||||
let choice = ui.prompt_choice(
|
||||
"enter the index of the commit you want to target",
|
||||
|
|
Loading…
Reference in a new issue