From 1e133615d887e583ae44d01985d6c1392420f3ef Mon Sep 17 00:00:00 2001 From: Brett Smith Date: Mon, 1 Jan 2024 11:38:57 +0000 Subject: [PATCH 1/4] Use finely grained `jline-terminal` rather than bundle jar `jline`. --- pom.xml | 4 ++-- src/main/java/module-info.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 78c16ea..1db7899 100644 --- a/pom.xml +++ b/pom.xml @@ -134,8 +134,8 @@ org.jline - jline - 3.23.0 + jline-terminal + 3.24.1 diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 647fb12..9758395 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -1,4 +1,4 @@ module me.tongfei.progressbar { - requires org.jline; + requires org.jline.terminal; exports me.tongfei.progressbar; } From ec86581dabbfd0f5853d626b4b7dc81a55879e83 Mon Sep 17 00:00:00 2001 From: Tongfei Chen Date: Mon, 1 Jan 2024 22:23:51 -0800 Subject: [PATCH 2/4] credit; docs --- docs/index.md | 4 ++-- mkdocs.yml | 4 +++- pom.xml | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/index.md b/docs/index.md index ff2ae89..fc862c6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,14 +12,14 @@ Depending on your build tool, add the following setting. me.tongfei progressbar - 0.9.4 + 0.10.0 ``` === "Gradle" ``` groovy - compile 'me.tongfei:progressbar:0.9.4' + compile 'me.tongfei:progressbar:0.10.0' ``` #### Getting started diff --git a/mkdocs.yml b/mkdocs.yml index c6eb9c9..ba513c7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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' diff --git a/pom.xml b/pom.xml index 1db7899..698d6a0 100644 --- a/pom.xml +++ b/pom.xml @@ -129,6 +129,10 @@ PakhomovAlexander Aleksandr Pakhomov + + brett-smith + Brett Smith + From 57046ac1142998cd9906610af2c30f95b9e8cd90 Mon Sep 17 00:00:00 2001 From: Tongfei Chen Date: Sun, 24 Mar 2024 00:19:33 -0700 Subject: [PATCH 3/4] setRenderer ;0.10.1 --- CHANGELOG.md | 4 ++++ LICENSE | 2 +- docs/index.md | 6 +++-- mkdocs.yml | 4 +++- pom.xml | 24 ++++++++++++++++++- .../progressbar/ProgressBarBuilder.java | 9 ++++++- 6 files changed, 43 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d99fc4..a2ac24c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 ! diff --git a/LICENSE b/LICENSE index afb16b3..4a58ef9 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/docs/index.md b/docs/index.md index fc862c6..d96581d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -12,16 +12,18 @@ Depending on your build tool, add the following setting. me.tongfei progressbar - 0.10.0 + $VERSION ``` === "Gradle" ``` groovy - compile 'me.tongfei:progressbar:0.10.0' + 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 diff --git a/mkdocs.yml b/mkdocs.yml index ba513c7..0017b9e 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,7 +1,7 @@ site_name: 'Progressbar' site_description: 'A terminal progress bar for Java/JVM' site_author: 'Tongfei Chen' -copyright: 'Copyright © 2015-2023 Tongfei Chen and contributors' +copyright: 'Copyright © 2015-2024 Tongfei Chen and contributors' theme: name: 'material' @@ -37,3 +37,5 @@ nav: - 'Kotlin extensions': 'kotlin.md' - 'Integrating with loggers': 'loggers.md' - 'Changelog': 'changelog.md' + - 'API Docs': + - 'index': 'dokka-javadoc/index.html' \ No newline at end of file diff --git a/pom.xml b/pom.xml index 698d6a0..4602d06 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.tongfei progressbar - 0.10.0 + 0.10.1 progressbar A terminal-based progress bar for JVM http://github.com/ctongfei/progressbar @@ -266,6 +266,28 @@ false + + org.jetbrains.dokka + dokka-maven-plugin + 1.9.10 + + + pre-site + + dokka + + + + + + + org.jetbrains.dokka + javadoc-plugin + 1.9.10 + + + + diff --git a/src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java b/src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java index 6dabdf8..6eb2c53 100644 --- a/src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java +++ b/src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java @@ -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) { @@ -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")); } @@ -129,7 +136,7 @@ public ProgressBar build() { clearDisplayOnFinish, processed, elapsed, - new DefaultProgressBarRenderer( + renderer == null ? new DefaultProgressBarRenderer( style, unitName, unitSize, showSpeed, speedFormat, speedUnit, !hideEta, eta), From 7ed2fa4cb2a427c7c1f4319539235208f7b27feb Mon Sep 17 00:00:00 2001 From: Tongfei Chen Date: Sun, 24 Mar 2024 00:27:30 -0700 Subject: [PATCH 4/4] formatting --- .../me/tongfei/progressbar/ProgressBarBuilder.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java b/src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java index 6eb2c53..7c6d035 100644 --- a/src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java +++ b/src/main/java/me/tongfei/progressbar/ProgressBarBuilder.java @@ -136,11 +136,17 @@ public ProgressBar build() { clearDisplayOnFinish, processed, elapsed, - renderer == null ? 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 + ) ); } }