Feature: width argument to calculate scale from number of available columns #6

Merged
giulio-Joshi merged 3 commits from columns_arg into master 2022-10-26 19:36:21 +00:00
2 changed files with 3 additions and 3 deletions
Showing only changes of commit 0933e157d5 - Show all commits

View file

@ -106,7 +106,7 @@ Options:
[default: 4]
-w, --width <WIDTH>
anas-elgarhy commented 2022-10-26 16:25:48 +00:00 (Migrated from github.com)
Review

Please copy this from the aarty --help output to save the consistency

Please copy this from the `aarty --help` output to save the consistency
In case you know how many columns are needed, this paramter will calcualte the scale factor for you.
Width expressed as text-columns, this parameter will calculate the scale factor for you.
Overrides `scale` parameter even when specified.
[default: disabled]

View file

@ -63,8 +63,8 @@ fn get_character(
}
///
/// Determine which scale to use in presence of `width` parameters,
/// otherwise uses regular `scale` parameter as default
/// Determine how much scale to use in presence of `width` parameters,
/// otherwise returns regular `scale` parameter per default behaviour
///
fn calculate_scale(args: &Arguments, dimensions: (u32, u32)) -> u32 {
args.width.map_or_else(|| args.scale, |v| dimensions.0 / v)