mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-19 19:08:08 +00:00
cli: branch: move command fn next to Command/Args type
This commit is contained in:
parent
9e35b9b218
commit
b9c2daa408
2 changed files with 18 additions and 18 deletions
|
@ -40,17 +40,6 @@ pub struct BranchForgetArgs {
|
|||
pub glob: Vec<StringPattern>,
|
||||
}
|
||||
|
||||
fn find_forgettable_branches(
|
||||
view: &View,
|
||||
name_patterns: &[StringPattern],
|
||||
) -> Result<Vec<String>, CommandError> {
|
||||
find_branches_with(name_patterns, |pattern| {
|
||||
view.branches()
|
||||
.filter(|(name, _)| pattern.matches(name))
|
||||
.map(|(name, _)| name.to_owned())
|
||||
})
|
||||
}
|
||||
|
||||
pub fn cmd_branch_forget(
|
||||
ui: &mut Ui,
|
||||
command: &CommandHelper,
|
||||
|
@ -76,3 +65,14 @@ pub fn cmd_branch_forget(
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn find_forgettable_branches(
|
||||
view: &View,
|
||||
name_patterns: &[StringPattern],
|
||||
) -> Result<Vec<String>, CommandError> {
|
||||
find_branches_with(name_patterns, |pattern| {
|
||||
view.branches()
|
||||
.filter(|(name, _)| pattern.matches(name))
|
||||
.map(|(name, _)| name.to_owned())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -69,13 +69,6 @@ pub enum BranchCommand {
|
|||
Untrack(BranchUntrackArgs),
|
||||
}
|
||||
|
||||
fn make_branch_term(branch_names: &[impl fmt::Display]) -> String {
|
||||
match branch_names {
|
||||
[branch_name] => format!("branch {}", branch_name),
|
||||
branch_names => format!("branches {}", branch_names.iter().join(", ")),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cmd_branch(
|
||||
ui: &mut Ui,
|
||||
command: &CommandHelper,
|
||||
|
@ -94,6 +87,13 @@ pub fn cmd_branch(
|
|||
}
|
||||
}
|
||||
|
||||
fn make_branch_term(branch_names: &[impl fmt::Display]) -> String {
|
||||
match branch_names {
|
||||
[branch_name] => format!("branch {}", branch_name),
|
||||
branch_names => format!("branches {}", branch_names.iter().join(", ")),
|
||||
}
|
||||
}
|
||||
|
||||
fn find_local_branches(
|
||||
view: &View,
|
||||
name_patterns: &[StringPattern],
|
||||
|
|
Loading…
Reference in a new issue