diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-01-05 00:38:55 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2025-01-05 00:38:55 +0100 |
| commit | d7fef30ac3f539975ef9edbba8e0af4a4e9ff3de (patch) | |
| tree | 1e71dd131261a8f7a13d86d4dddd7d421e6a09f4 /src/remote | |
| parent | d26464d12e41e8d53fca8d0e5f9cc6ac03e48f9a (diff) | |
Commit batch of lints to allow autofix
Diffstat (limited to 'src/remote')
| -rw-r--r-- | src/remote/git.rs | 15 | ||||
| -rw-r--r-- | src/remote/mod.rs | 22 |
2 files changed, 25 insertions, 12 deletions
diff --git a/src/remote/git.rs b/src/remote/git.rs index 66c5a89..a8a9010 100644 --- a/src/remote/git.rs +++ b/src/remote/git.rs @@ -18,15 +18,24 @@ impl super::Remote for Git { } fn sync_up(&self, remote: &str, directory: &PathBuf) -> Result<()> { - let timestamp = SystemTime::now().duration_since(UNIX_EPOCH) + let timestamp = SystemTime::now() + .duration_since(UNIX_EPOCH) .map_err(|_| Error::new(Other, "Invalid time"))? .as_millis(); let commands = vec![ format!("cd {} && git init -b main", directory.display()), format!("cd {} && git add .", directory.display()), - format!("cd {} && git commit --allow-empty -m blog-sync-up-{}", directory.display(), timestamp), - format!("cd {} && git push {} main --force", directory.display(), remote), + format!( + "cd {} && git commit --allow-empty -m blog-sync-up-{}", + directory.display(), + timestamp + ), + format!( + "cd {} && git push {} main --force", + directory.display(), + remote + ), ]; for command in commands { diff --git a/src/remote/mod.rs b/src/remote/mod.rs index 19514af..49bfeb0 100644 --- a/src/remote/mod.rs +++ b/src/remote/mod.rs @@ -26,8 +26,8 @@ pub fn remove(remote_config: &PathBuf) -> Result<()> { } pub fn sync_up(data_directory: &PathBuf, remote_config: &PathBuf) -> Result<()> { - let remote_address = read_remote(remote_config) - .ok_or_else(|| Error::new(Other, "No remote is configured"))?; + let remote_address = + read_remote(remote_config).ok_or_else(|| Error::new(Other, "No remote is configured"))?; create_dir_all(data_directory)?; let remotes = available_remotes(); for remote in remotes { @@ -35,12 +35,15 @@ pub fn sync_up(data_directory: &PathBuf, remote_config: &PathBuf) -> Result<()> return remote.sync_up(&remote_address, data_directory); } } - Err(Error::new(Other, "No valid strategies found for your configured remote.")) + Err(Error::new( + Other, + "No valid strategies found for your configured remote.", + )) } pub fn sync_down(data_directory: &PathBuf, remote_config: &PathBuf) -> Result<()> { - let remote_address = read_remote(remote_config) - .ok_or_else(|| Error::new(Other, "No remote is configured"))?; + let remote_address = + read_remote(remote_config).ok_or_else(|| Error::new(Other, "No remote is configured"))?; create_dir_all(data_directory)?; let remotes = available_remotes(); for remote in remotes { @@ -48,13 +51,14 @@ pub fn sync_down(data_directory: &PathBuf, remote_config: &PathBuf) -> Result<() return remote.sync_down(&remote_address, data_directory); } } - Err(Error::new(Other, "No valid strategies found for your configured remote.")) + Err(Error::new( + Other, + "No valid strategies found for your configured remote.", + )) } fn available_remotes() -> Vec<Box<dyn Remote>> { - vec![ - Box::new(Git::new()) - ] + vec![Box::new(Git::new())] } fn read_remote(file_path: &PathBuf) -> Option<String> { |