mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2025-01-07 10:26:45 +03:00
parent
23741716f9
commit
0f4a799882
@ -3,7 +3,10 @@ use clap::Args;
|
|||||||
use colored::Colorize;
|
use colored::Colorize;
|
||||||
use dialoguer::{console::Term, theme::ColorfulTheme, Input, Select};
|
use dialoguer::{console::Term, theme::ColorfulTheme, Input, Select};
|
||||||
|
|
||||||
use gitbutler::{reader, sessions, virtual_branches};
|
use gitbutler::{
|
||||||
|
reader, sessions,
|
||||||
|
virtual_branches::{self, BranchId},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::app::App;
|
use crate::app::App;
|
||||||
|
|
||||||
@ -24,19 +27,15 @@ impl super::RunCommand for Commit {
|
|||||||
let current_session_reader = sessions::Reader::open(&gb_repository, ¤t_session)
|
let current_session_reader = sessions::Reader::open(&gb_repository, ¤t_session)
|
||||||
.context("failed to open current session reader")?;
|
.context("failed to open current session reader")?;
|
||||||
|
|
||||||
let virtual_branches = virtual_branches::Iterator::new(¤t_session_reader)
|
let (ids, names): (Vec<BranchId>, Vec<String>) =
|
||||||
.context("failed to read virtual branches")?
|
virtual_branches::Iterator::new(¤t_session_reader)
|
||||||
.collect::<Result<Vec<virtual_branches::branch::Branch>, reader::Error>>()
|
.context("failed to read virtual branches")?
|
||||||
.context("failed to read virtual branches")?
|
.collect::<Result<Vec<virtual_branches::branch::Branch>, reader::Error>>()
|
||||||
.into_iter()
|
.context("failed to read virtual branches")?
|
||||||
.collect::<Vec<_>>();
|
.into_iter()
|
||||||
|
.map(|b| (b.id, b.name))
|
||||||
|
.unzip();
|
||||||
|
|
||||||
let mut ids = Vec::new();
|
|
||||||
let mut names = Vec::new();
|
|
||||||
for branch in virtual_branches {
|
|
||||||
ids.push(branch.id);
|
|
||||||
names.push(branch.name);
|
|
||||||
}
|
|
||||||
let selection = match Select::with_theme(&ColorfulTheme::default())
|
let selection = match Select::with_theme(&ColorfulTheme::default())
|
||||||
.items(&names)
|
.items(&names)
|
||||||
.default(0)
|
.default(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user