Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,8 @@ public object Property
[Parameter]
public SwitchParameter AutoSize
{
get
{
if (_autosize.HasValue)
return _autosize.Value;
return false;
}

set
{
_autosize = value;
}
get => _autosize.GetValueOrDefault();
set => _autosize = value;
}

private bool? _autosize = null;
Expand All @@ -70,17 +61,8 @@ public SwitchParameter AutoSize
[ValidateRangeAttribute(1, int.MaxValue)]
public int Column
{
get
{
if (_column.HasValue)
return _column.Value;
return -1;
}

set
{
_column = value;
}
get => _column.GetValueOrDefault(-1);
set => _column = value;
}

private int? _column = null;
Expand Down Expand Up @@ -110,22 +92,19 @@ internal override FormattingCommandLineParameters GetCommandLineParameters()
}

// we cannot specify -column and -autosize, they are mutually exclusive
if (_autosize.HasValue && _column.HasValue)
if (AutoSize && _column.HasValue)
{
if (_autosize.Value)
{
// the user specified -autosize:true AND a column number
string msg = StringUtil.Format(FormatAndOut_format_xxx.CannotSpecifyAutosizeAndColumnsError);
// the user specified -autosize:true AND a column number
string msg = StringUtil.Format(FormatAndOut_format_xxx.CannotSpecifyAutosizeAndColumnsError);

ErrorRecord errorRecord = new(
new InvalidDataException(),
"FormatCannotSpecifyAutosizeAndColumns",
ErrorCategory.InvalidArgument,
null);
ErrorRecord errorRecord = new(
new InvalidDataException(),
"FormatCannotSpecifyAutosizeAndColumns",
ErrorCategory.InvalidArgument,
null);

errorRecord.ErrorDetails = new ErrorDetails(msg);
this.ThrowTerminatingError(errorRecord);
}
errorRecord.ErrorDetails = new ErrorDetails(msg);
this.ThrowTerminatingError(errorRecord);
}

parameters.groupByParameter = this.ProcessGroupByParameter();
Expand Down