Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#563 Rename parameter versions.displayTerminalWidth to versions.outputLineWidth #573

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:display-dependency-updates
invoker.mavenOpts=-Dverbose=true -Dversions.outputFile=./dependencyUpdate.txt -DoutputEncoding=UTF-8 -Dversions.displayTerminalWidth=120
invoker.mavenOpts=-Dverbose=true -Dversions.outputFile=./dependencyUpdate.txt -DoutputEncoding=UTF-8 -Dversions.outputLineWidth=120
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:display-plugin-updates -Dversions.outputFile=./dependencyUpdate.txt -Dversions.displayTerminalWidth=120
invoker.goals=${project.groupId}:${project.artifactId}:${project.version}:display-plugin-updates -Dversions.outputFile=./dependencyUpdate.txt -Dversions.outputLineWidth=120
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invoker.goals=-DautoLinkItems=true ${project.groupId}:${project.artifactId}:${project.version}:display-property-updates -Dversions.outputFile=./dependencyUpdate.txt -Dversions.displayTerminalWidth=120
invoker.goals=-DautoLinkItems=true ${project.groupId}:${project.artifactId}:${project.version}:display-property-updates -Dversions.outputFile=./dependencyUpdate.txt -Dversions.outputLineWidth=120
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public abstract class AbstractVersionsDisplayMojo
extends AbstractVersionsUpdaterMojo
{

private static final int DEFAULT_DISPLAY_TERMINAL_WIDTH = 80;
private static final int DEFAULT_OUTPUT_LINE_WIDTH = 80;

/**
* If specified then the display output will be sent to the specified file.
Expand All @@ -64,12 +64,12 @@ public abstract class AbstractVersionsDisplayMojo
private String outputEncoding;

/**
* Terminal width which should be used to format the padding of the version info list output.
* Line width which should be used to format the padding of the version info list output.
*
* @since 2.10.0
*/
@Parameter( property = "versions.displayTerminalWidth", defaultValue = AbstractVersionsDisplayMojo.DEFAULT_DISPLAY_TERMINAL_WIDTH + "" )
private int displayTerminalWidth;
@Parameter( property = "versions.outputLineWidth", defaultValue = AbstractVersionsDisplayMojo.DEFAULT_OUTPUT_LINE_WIDTH + "" )
private int outputLineWidth;

private boolean outputFileError = false;

Expand Down Expand Up @@ -162,10 +162,10 @@ protected void logLine( boolean error, String line )
}

/**
* @return Offset of the configured display terminal width compared to the default with of 80.
* @return Offset of the configured output line width compared to the default with of 80.
*/
protected int getDisplayTerminalWidthOffset() {
return this.displayTerminalWidth - DEFAULT_DISPLAY_TERMINAL_WIDTH;
protected int getOutputLineWidthOffset() {
return this.outputLineWidth - DEFAULT_OUTPUT_LINE_WIDTH;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -436,15 +436,15 @@ private void logUpdates( Map<Dependency, ArtifactVersions> updates, String secti
}
String right = " " + ( latest == null ? current : current + " -> " + latest );
List<String> t = latest == null ? usingCurrent : withUpdates;
if ( right.length() + left.length() + 3 > INFO_PAD_SIZE + getDisplayTerminalWidthOffset() )
if ( right.length() + left.length() + 3 > INFO_PAD_SIZE + getOutputLineWidthOffset() )
{
t.add( left + "..." );
t.add( StringUtils.leftPad( right, INFO_PAD_SIZE + getDisplayTerminalWidthOffset() ) );
t.add( StringUtils.leftPad( right, INFO_PAD_SIZE + getOutputLineWidthOffset() ) );

}
else
{
t.add( StringUtils.rightPad( left, INFO_PAD_SIZE + getDisplayTerminalWidthOffset() - right.length(), "." ) + right );
t.add( StringUtils.rightPad( left, INFO_PAD_SIZE + getOutputLineWidthOffset() - right.length(), "." ) + right );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,12 +476,12 @@ public void execute()
{
// plugin version configured that require a Maven version higher than spec
upgradePlugins.put( upgradePluginKey,
pad( upgradePluginKey, INFO_PAD_SIZE + getDisplayTerminalWidthOffset(), newer ) );
pad( upgradePluginKey, INFO_PAD_SIZE + getOutputLineWidthOffset(), newer ) );
}
else
{
// plugin that can be upgraded
upgradePlugins.put( upgradePluginKey, pad( upgradePluginKey, INFO_PAD_SIZE + getDisplayTerminalWidthOffset(),
upgradePlugins.put( upgradePluginKey, pad( upgradePluginKey, INFO_PAD_SIZE + getOutputLineWidthOffset(),
effectiveVersion, " -> ", newer ) );
}
}
Expand Down Expand Up @@ -551,7 +551,7 @@ public void execute()
superPomDrivingMinVersion = true;
}

pluginLockdowns.add( pad( compactKey( groupId, artifactId ), WARN_PAD_SIZE + getDisplayTerminalWidthOffset(),
pluginLockdowns.add( pad( compactKey( groupId, artifactId ), WARN_PAD_SIZE + getOutputLineWidthOffset(),
superPomDrivingMinVersion ? FROM_SUPER_POM : "", newVersion ) );
}
else if ( artifactVersion != null )
Expand All @@ -565,7 +565,7 @@ else if ( artifactVersion != null )
if ( version != null && artifactVersion != null && newVersion != null && effectiveVersion != null
&& new DefaultArtifactVersion( effectiveVersion ).compareTo( new DefaultArtifactVersion( newVersion ) ) < 0 )
{
pluginUpdates.add( pad( compactKey( groupId, artifactId ), INFO_PAD_SIZE + getDisplayTerminalWidthOffset(),
pluginUpdates.add( pad( compactKey( groupId, artifactId ), INFO_PAD_SIZE + getOutputLineWidthOffset(),
effectiveVersion, " -> ", newVersion ) );
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public void execute()
buf.append( property.getName() );
buf.append( "} " );
final String newVersion = winner.toString();
int padding = INFO_PAD_SIZE - currentVersion.length() - newVersion.length() - 4 + getDisplayTerminalWidthOffset();
int padding = INFO_PAD_SIZE - currentVersion.length() - newVersion.length() - 4 + getOutputLineWidthOffset();
while ( buf.length() < padding )
{
buf.append( '.' );
Expand All @@ -165,7 +165,7 @@ public void execute()
buf.append( "${" );
buf.append( property.getName() );
buf.append( "} " );
int padding = INFO_PAD_SIZE - currentVersion.length() + getDisplayTerminalWidthOffset();
int padding = INFO_PAD_SIZE - currentVersion.length() + getOutputLineWidthOffset();
while ( buf.length() < padding )
{
buf.append( '.' );
Expand Down