git-checkout-interactive 1.0.9

cli to switch between locally checked out branches interactively
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use core::error::Error;
use dialoguer::Select;
use git2::Repository;
use std::env::current_dir;

fn main() -> Result<(), Box<dyn Error>> {
    let repo = Repository::open(current_dir()?)?;
    git_checkout_interactive::run_with_selector(&repo, |prompt, items| {
        Ok(Select::new()
            .with_prompt(prompt)
            .items(items)
            .default(0)
            .interact_opt()?)
    })
}