Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,9 +1222,8 @@ pub struct Args {
/// to the data and the MIME type 'png' will be attached to it.
/// Furthermore, '-' can only be used once.
#[arg(short, long, num_args(0..), )]
file: Vec<String>,
file: Vec<PathBuf>,

// Todo: change this Vec<String> to Vec<PathBuf> for --file
/// Specify the message type as Notice.
/// Details::
/// There are 3 message types for '--message'.
Expand Down Expand Up @@ -3014,11 +3013,15 @@ pub(crate) async fn cli_file(client: &Client, ap: &Args) -> Result<(), Error> {
}
let mut files: Vec<PathBuf> = Vec::new();
for filename in &ap.file {
match filename.as_str() {
"" => info!("Skipping empty file name."),
r"-" => files.push(PathBuf::from("-".to_string())),
r"\-" => files.push(PathBuf::from(r"\-".to_string())),
_ => files.push(PathBuf::from(filename)),
match filename.to_str() {
Some("") => info!("Skipping empty file name."),
Some(r"-") => files.push(PathBuf::from("-")),
Some(r"\-") => files.push(PathBuf::from(r"\-")),
Some(_) => files.push(filename.clone()),
None => {
warn!("Skipping file with invalid UTF-8 path: {:?}", filename);
continue;
}
}
}
// pb: label to attach to a stdin pipe data in case there is data piped in from stdin
Expand Down