-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ark-cli): add watch command to use fs-index watch api
Signed-off-by: Tarek <[email protected]>
- Loading branch information
1 parent
1d35318
commit 6aa9e49
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use std::path::PathBuf; | ||
|
||
use fs_index::watch_index; | ||
|
||
use crate::{AppError, ResourceId}; | ||
|
||
#[derive(Clone, Debug, clap::Args)] | ||
#[clap( | ||
name = "watch", | ||
about = "Watch the ark managed folder for changes and update the index accordingly" | ||
)] | ||
pub struct Watch { | ||
#[clap( | ||
help = "Path to the directory to watch for changes", | ||
default_value = ".", | ||
value_parser | ||
)] | ||
path: PathBuf, | ||
} | ||
|
||
impl Watch { | ||
pub async fn run(&self) -> Result<(), AppError> { | ||
watch_index::<_, ResourceId>(&self.path) | ||
.await | ||
.map_err(|err| AppError::IndexError(err.to_string())) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters