add universal output flag (#319)

* add universal filenames setting

* rename flag and help
This commit is contained in:
kralverde 2024-01-29 02:24:56 -05:00 committed by GitHub
parent a4abb14ae3
commit 982e521e0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 35 additions and 23 deletions

View file

@ -60,6 +60,11 @@ pub struct Download {
#[arg(long)]
pub(crate) output_specials: Option<String>,
#[arg(help = "Sanitize the output file for use with all operating systems. \
This option only affects template options and not static characters.")]
#[arg(long, default_value_t = false)]
pub(crate) universal_output: bool,
#[arg(help = "Video resolution")]
#[arg(long_help = "The video resolution. \
Can either be specified via the pixels (e.g. 1920x1080), the abbreviation for pixels (e.g. 1080p) or 'common-use' words (e.g. best). \
@ -254,9 +259,10 @@ impl Execute for Download {
self.output_specials
.as_ref()
.map_or((&self.output).into(), |so| so.into()),
self.universal_output,
)
} else {
format.format_path((&self.output).into())
format.format_path((&self.output).into(), self.universal_output)
};
let (path, changed) = free_file(formatted_path.clone());