feat: take the store root as an option

This commit is contained in:
2026-09-08 09:57:01 +00:00
parent 11ecd0ac89
commit 4b1e9d68b0
6 changed files with 59 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
use std::path::PathBuf;
use clap::Subcommand;
use clap::{Args, Subcommand};
#[derive(Subcommand, Debug)]
pub enum Link {
@@ -13,6 +13,9 @@ pub enum Link {
/// Link to a store path that already exists
#[arg(long)]
force: bool,
#[command(flatten)]
store: Store,
},
/// Move paths in the store back into the repository
@@ -22,6 +25,9 @@ pub enum Link {
/// Restore every path this repository has in the store
#[arg(long)]
all: bool,
#[command(flatten)]
store: Store,
},
/// List untracked paths a sandbox would still see
@@ -40,5 +46,17 @@ pub enum Link {
/// Terminate porcelain entries with NUL
#[arg(short = 'z')]
null: bool,
#[command(flatten)]
store: Store,
},
}
#[derive(Args, Debug)]
pub struct Store {
/// Where the out-of-repo store lives
///
/// Defaults to `${XDG_DATA_HOME:-$HOME/.local/share}/ahab`.
#[arg(long = "store", env = "AHAB_LINK_ROOT", value_name = "DIR")]
pub root: Option<PathBuf>,
}