Add migrate cli command
This commit is contained in:
parent
909399b276
commit
9d2d1fa3c1
9 changed files with 31 additions and 1247 deletions
|
|
@ -1,8 +1,5 @@
|
|||
pub mod data;
|
||||
pub mod ids;
|
||||
mod paths;
|
||||
|
||||
pub use crate::paths::Paths;
|
||||
|
||||
pub const PROPER_NAME: &str = "GedächtNAS";
|
||||
pub const TECHNICAL_NAME: &str = "gedaechtnas";
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
use std::path::PathBuf;
|
||||
|
||||
use directories::ProjectDirs;
|
||||
|
||||
pub struct Paths(ProjectDirs);
|
||||
|
||||
impl Paths {
|
||||
pub fn on_linux() -> Option<Self> {
|
||||
ProjectDirs::from("de", "plugh", crate::TECHNICAL_NAME).map(Self)
|
||||
}
|
||||
|
||||
pub fn on_windows() -> Option<Self> {
|
||||
ProjectDirs::from("de", "plugh", crate::PROPER_NAME).map(Self)
|
||||
}
|
||||
|
||||
pub fn state_file(&self) -> PathBuf {
|
||||
self.0.data_local_dir().join("state.json")
|
||||
}
|
||||
|
||||
pub fn repos_dir(&self) -> PathBuf {
|
||||
self.0.data_local_dir().join("repos")
|
||||
}
|
||||
|
||||
pub fn repo_dir(&self, name: &str) -> PathBuf {
|
||||
self.repos_dir().join(format!("{name}.git"))
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue