Skip to main content

git_stk/commands/
adopt.rs

1use anyhow::Result;
2use clap_complete::engine::ArgValueCompleter;
3
4use crate::commands::Run;
5use crate::completions;
6
7/// Attach an existing branch to a parent.
8#[derive(Debug, clap::Args)]
9pub struct Adopt {
10    #[arg(add = ArgValueCompleter::new(completions::branch_candidates))]
11    branch: String,
12    #[arg(long, add = ArgValueCompleter::new(completions::branch_candidates))]
13    parent: String,
14}
15
16impl Run for Adopt {
17    fn run(self) -> Result<()> {
18        crate::stack::adopt_branch(&self.branch, &self.parent)
19    }
20}