about summary refs log tree commit diff
path: root/src/actions/mod.rs
blob: 86af9551ae148e59c9415f44931babb79afbd846 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
mod create;
mod shift;
mod update;

use std::path::{Path, PathBuf};

use anyhow::Result;
pub use create::create;
pub use shift::shift;
pub use update::update;

pub struct ActionOptions {
    pub repository_path: PathBuf,
}

impl ActionOptions {
    pub fn from_path(path: &str) -> Self {
        ActionOptions {
            repository_path: Path::new(path).to_path_buf(),
        }
    }

    pub fn from_pwd() -> Result<Self> {
        let repository_path = std::env::current_dir()?;
        Ok(ActionOptions { repository_path })
    }
}