Skip to content

Commit

Permalink
Merge pull request #161 from ctongfei/0.10.1
Browse files Browse the repository at this point in the history
0.10.1
  • Loading branch information
ctongfei authored Mar 24, 2024
2 parents 5af6755 + 7ed2fa4 commit 4c80a7f
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
* `0.10.1`:
- Improvements:
- Changed the JPMS module dependency `org.jline` to a more fine-grained module `org.jline.terminal` (#158, PR #159). Thanks @brett-smith !
- Added a new builder method `setRenderer` to allow custom renderers (#157). Thanks @drothmaler !
* `0.10.0`:
- New functionalities:
- Make `me.tongfei.progressbar` a Java 9 module (#149, #153, #154). Thanks @clo-vis, @Kamillaova, @bowbahdoe !
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015--2020 Tongfei Chen and contributors
Copyright (c) 2015--2024 Tongfei Chen and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 4 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ Depending on your build tool, add the following setting.
<dependency>
<groupId>me.tongfei</groupId>
<artifactId>progressbar</artifactId>
<version>0.9.4</version>
<version>$VERSION</version>
</dependency>
```

=== "Gradle"

``` groovy
compile 'me.tongfei:progressbar:0.9.4'
compile 'me.tongfei:progressbar:$VERSION'
```

The newest `$VERSION` is [![Maven Central](https://img.shields.io/maven-central/v/me.tongfei/progressbar.svg?style=flat-square)](https://maven-badges.herokuapp.com/maven-central/me.tongfei/progressbar).

#### Getting started

``` java
Expand Down
8 changes: 6 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
site_name: 'Progressbar'
site_description: 'A terminal progress bar for Java/JVM'
site_author: 'Tongfei Chen'
copyright: 'Copyright &copy; 2015-2023 Tongfei Chen and contributors'
copyright: 'Copyright &copy; 2015-2024 Tongfei Chen and contributors'

theme:
name: 'material'
Expand All @@ -19,7 +19,9 @@ markdown_extensions:
permalink: true
- pymdownx.superfences
- pymdownx.highlight
- pymdownx.tabbed
- pymdownx.tabbed:
alternate_style: true
- admonition

repo_name: 'ctongfei/progressbar'
repo_url: 'https://github.com/ctongfei/progressbar'
Expand All @@ -35,3 +37,5 @@ nav:
- 'Kotlin extensions': 'kotlin.md'
- 'Integrating with loggers': 'loggers.md'
- 'Changelog': 'changelog.md'
- 'API Docs':
- 'index': 'dokka-javadoc/index.html'
32 changes: 29 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.tongfei</groupId>
<artifactId>progressbar</artifactId>
<version>0.10.0</version>
<version>0.10.1</version>
<name>progressbar</name>
<description>A terminal-based progress bar for JVM</description>
<url>http://github.com/ctongfei/progressbar</url>
Expand Down Expand Up @@ -129,13 +129,17 @@
<id>PakhomovAlexander</id>
<name>Aleksandr Pakhomov</name>
</developer>
<developer>
<id>brett-smith</id>
<name>Brett Smith</name>
</developer>
</developers>

<dependencies>
<dependency>
<groupId>org.jline</groupId>
<artifactId>jline</artifactId>
<version>3.23.0</version>
<artifactId>jline-terminal</artifactId>
<version>3.24.1</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -262,6 +266,28 @@
<useModulePath>false</useModulePath> <!-- tests use classpath -->
</configuration>
</plugin>
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>dokka-maven-plugin</artifactId>
<version>1.9.10</version>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>dokka</goal>
</goals>
</execution>
</executions>
<configuration>
<dokkaPlugins>
<plugin>
<groupId>org.jetbrains.dokka</groupId>
<artifactId>javadoc-plugin</artifactId>
<version>1.9.10</version>
</plugin>
</dokkaPlugins>
</configuration>
</plugin>

</plugins>
</build>
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public class ProgressBarBuilder {
private Duration elapsed = Duration.ZERO;
private int maxRenderedLength = -1;

private ProgressBarRenderer renderer = null;

public ProgressBarBuilder() { }

public ProgressBarBuilder setTaskName(String task) {
Expand Down Expand Up @@ -83,6 +85,11 @@ public ProgressBarBuilder setMaxRenderedLength(int maxRenderedLength) {
return this;
}

public ProgressBarBuilder setRenderer(ProgressBarRenderer renderer) {
this.renderer = renderer;
return this;
}

public ProgressBarBuilder showSpeed() {
return showSpeed(new DecimalFormat("#.0"));
}
Expand Down Expand Up @@ -129,11 +136,17 @@ public ProgressBar build() {
clearDisplayOnFinish,
processed,
elapsed,
new DefaultProgressBarRenderer(
style, unitName, unitSize,
(renderer == null
? new DefaultProgressBarRenderer(
style, unitName, unitSize,
showSpeed, speedFormat, speedUnit,
!hideEta, eta),
consumer == null ? Util.createConsoleConsumer(maxRenderedLength) : consumer
!hideEta, eta)
: renderer
),
(consumer == null
? Util.createConsoleConsumer(maxRenderedLength)
: consumer
)
);
}
}
2 changes: 1 addition & 1 deletion src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module me.tongfei.progressbar {
requires org.jline;
requires org.jline.terminal;
exports me.tongfei.progressbar;
}

0 comments on commit 4c80a7f

Please sign in to comment.