Skip to main content

git_stk/commands/
setup.rs

1use anyhow::Result;
2use clap::ArgAction;
3
4use crate::commands::Run;
5
6/// Install the man page and wire up shell completions.
7#[derive(Debug, clap::Args)]
8pub struct Setup {
9    /// Skip confirmation prompts.
10    #[arg(long, short = 'y', action = ArgAction::SetTrue)]
11    yes: bool,
12    /// Only re-render generated assets (man page); never touch shell rc files.
13    #[arg(long, action = ArgAction::SetTrue, conflicts_with = "yes")]
14    refresh: bool,
15    /// Also define an `stk` shell function whose up/down/top/bottom cd into the
16    /// worktree holding the branch (bash and zsh only).
17    #[arg(long, action = ArgAction::SetTrue, conflicts_with = "refresh")]
18    wrapper: bool,
19}
20
21impl Run for Setup {
22    fn run(self) -> Result<()> {
23        crate::setup::setup(self.yes, self.refresh, self.wrapper)
24    }
25}