chore
This commit is contained in:
+2
-6
@@ -25,7 +25,7 @@ pub async fn file(file: &File, root: &str, dry_run: bool) -> Result<()> {
|
||||
let kind = file.kind();
|
||||
let content = kind.content()?;
|
||||
|
||||
use crate::{FileKind as K};
|
||||
use crate::FileKind as K;
|
||||
match kind.as_ref() {
|
||||
K::Skip => {
|
||||
info!("{}: kind is skip", file.path);
|
||||
@@ -34,11 +34,7 @@ pub async fn file(file: &File, root: &str, dry_run: bool) -> Result<()> {
|
||||
K::Content(_) | K::Content64(_) | K::Parts(_) => {
|
||||
let content = content.expect("this file kind should have content");
|
||||
if dry_run {
|
||||
info!(
|
||||
"would create {} ({} bytes)",
|
||||
file.path,
|
||||
content.len()
|
||||
);
|
||||
info!("would create {} ({} bytes)", file.path, content.len());
|
||||
} else {
|
||||
fs::write(path, &content).await?;
|
||||
}
|
||||
|
||||
+2
-2
@@ -111,12 +111,12 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn base64_decode(s: &str) -> Result<Vec<u8>, base64::DecodeError> {
|
||||
use base64::{prelude::BASE64_STANDARD_NO_PAD as B64, Engine as _};
|
||||
use base64::{Engine as _, prelude::BASE64_STANDARD_NO_PAD as B64};
|
||||
B64.decode(s.trim_end_matches('='))
|
||||
}
|
||||
|
||||
pub fn base64_encode(b: &[u8]) -> String {
|
||||
use base64::{prelude::BASE64_STANDARD as B64, Engine as _};
|
||||
use base64::{Engine as _, prelude::BASE64_STANDARD as B64};
|
||||
B64.encode(b)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user