Add git dependencies and prep for async.

pull/3/head
Joshua Potter 2021-12-31 10:17:55 -05:00
parent c6bd229640
commit 606e3da69f
5 changed files with 25 additions and 4 deletions

View File

@ -8,6 +8,6 @@ filesToFormat=$(
for path in $filesToFormat
do
rustfmt $path
rustfmt --edition 2021 $path
git add $path
done;

View File

@ -12,7 +12,9 @@ edition = "2021"
[dependencies]
ansi_term = "0.12.1"
clap = { version = "3.0.0-rc.9", features = ["derive"] }
git2 = "0.13.25"
notify = "4.0.16"
octocrab = "0.15"
regex = "1.5.4"
serde = "1.0"
serde_derive = "1.0.132"

18
src/git.rs Normal file
View File

@ -0,0 +1,18 @@
use super::config::PathConfig;
use git2::Repository;
use octocrab;
/// Sets up a local github repository all configuration files will be synced to.
/// We attempt to clone the remote repository in favor of building our own.
///
/// If a remote repository exists, we verify its managed by homesync (based on
/// the presence of a sentinel file `.homesync`). Otherwise we raise an error.
///
/// If there is no local repository but a remote is available, we clone it.
/// Otherwise we create a new, empty repository.
///
/// NOTE! This does not perform any syncing between local and remote. That
/// should be done as a specific command line request.
pub async fn init(config: &PathConfig) {
// TODO(jrpotter): Fill this out.
}

View File

@ -1,6 +1,7 @@
pub mod cli;
pub mod config;
pub mod daemon;
pub mod git;
pub mod path;
use config::PathConfig;

View File

@ -30,9 +30,9 @@ fn main() {
.help("How often (in seconds) we poll/debounce file system changes")
.long_help(
"There exists a balance between how responsive changes are \
made and how expensive it is to look for changes. \
Empirically we found the default value to offer a nice \
compromise but this can be tweaked based on preference.",
made and how expensive it is to look for changes. Empirically we found the \
default value to offer a nice compromise but this can be tweaked based on \
preference.",
)
.takes_value(true)
.default_value("5"),