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
28
29
30
31
32
33
34
35
36
37
38
use eyre::Result;
/// Never capture paths matching a glob
///
/// Adds the glob to `[history] exclude` in the global config. Use it for
/// logs, caches, databases, and constantly rewritten application state; a
/// file that genuinely holds configuration but changes constantly is
/// better tracked with `--no-autosave` and saved explicitly.
#[derive(Debug, usage_rs::Args)]
#[usage(verbatim_doc_comment)]
pub(crate) struct DotfilesExclude {
/// A glob such as `~/.config/hypr/plugins/**`
glob: String,
}
impl DotfilesExclude {
pub(crate) async fn run(self) -> Result<()> {
let _declarations = super::track::declaration_lock()?;
super::paths::edit_exclude(&self.glob, true)
}
}
/// Capture paths matching a glob again
///
/// Removes the glob from `[history] exclude` in the global config.
#[derive(Debug, usage_rs::Args)]
#[usage(verbatim_doc_comment)]
pub(crate) struct DotfilesInclude {
/// The glob as written by `exclude`
glob: String,
}
impl DotfilesInclude {
pub(crate) async fn run(self) -> Result<()> {
let _declarations = super::track::declaration_lock()?;
super::paths::edit_exclude(&self.glob, false)
}
}