Skip to content

Commit

Permalink
Output formatting update
Browse files Browse the repository at this point in the history
  • Loading branch information
abdolence committed Aug 11, 2024
1 parent c5a5aab commit 537572b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
16 changes: 5 additions & 11 deletions src/commands/copy_command.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::errors::AppError;
use crate::filesystems::{
AbsoluteFilePath, DetectFileSystem, FileMatcher, FileMatcherResult, FileSystemConnection,
FileSystemRef,
DetectFileSystem, FileMatcher, FileMatcherResult, FileSystemConnection, FileSystemRef,
};
use crate::redacters::{
RedactSupportedOptions, Redacter, RedacterBaseOptions, RedacterOptions, Redacters,
Expand Down Expand Up @@ -205,7 +204,7 @@ async fn transfer_and_redact_file<
};
bar.println(
format!(
"Copying {} ({},{}) to {}. Size: {}",
"Processing {} ({},{}) to {}. Size: {}",
bold_style.apply_to(&base_resolved_file_ref.file_path),
base_resolved_file_ref.scheme,
file_ref
Expand All @@ -224,7 +223,6 @@ async fn transfer_and_redact_file<
destination_fs,
bold_style,
source_reader,
&base_resolved_file_ref,
file_ref,
redacter_with_options,
)
Expand All @@ -249,7 +247,6 @@ async fn redact_upload_file<
destination_fs: &mut DFS,
bold_style: Style,
source_reader: S,
base_resolved_file_ref: &AbsoluteFilePath,
dest_file_ref: &FileSystemRef,
redacter_with_options: &(RedacterBaseOptions, Vec<impl Redacter>),
) -> AppResult<crate::commands::copy_command::TransferFileResult> {
Expand Down Expand Up @@ -280,9 +277,8 @@ async fn redact_upload_file<
Err(ref error) => {
bar.println(
format!(
"{}. Skipping {} due to: {}\n{:?}\n",
"{}. Skipping due to: {}\n{:?}\n",
bold_style.clone().red().apply_to("Error redacting"),
bold_style.apply_to(&base_resolved_file_ref.file_path),
bold_style.apply_to(error),
error.source()
)
Expand All @@ -294,8 +290,7 @@ async fn redact_upload_file<
} else if redacter_base_options.allow_unsupported_copies {
bar.println(
format!(
"Still copying {} {} because it is allowed by arguments",
bold_style.apply_to(&base_resolved_file_ref.file_path),
"↳ Still copying {} because it is allowed by arguments",
bold_style
.clone()
.yellow()
Expand All @@ -310,8 +305,7 @@ async fn redact_upload_file<
} else {
bar.println(
format!(
"Skipping redaction of {} because {} media type is not supported",
bold_style.apply_to(&base_resolved_file_ref.file_path),
"↲ Skipping redaction because {} media type is not supported",
bold_style.apply_to(
dest_file_ref
.media_type
Expand Down
4 changes: 1 addition & 3 deletions src/redacters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use futures::{Stream, TryStreamExt};
use gcloud_sdk::prost::bytes;
use indicatif::ProgressBar;
use mime::Mime;
use rvstruct::ValueStruct;
use std::fmt::Display;

mod gcp_dlp;
Expand Down Expand Up @@ -300,8 +299,7 @@ pub async fn redact_stream<
for (redacter, options) in redacters_supported_options {
if !matches!(options, RedactSupportedOptions::Unsupported) {
bar.println(format!(
"Redacting {} with {} redacter",
file_ref.relative_path.value(),
"↳ Redacting using {} redacter",
redacter.redacter_type()
));
item_to_redact = redacter.redact(item_to_redact).await?;
Expand Down

0 comments on commit 537572b

Please sign in to comment.