[maven-debian-helper] 06/08: Default value for the simple questions
Emmanuel Bourg
ebourg-guest at moszumanska.debian.org
Wed Feb 5 14:17:22 UTC 2014
This is an automated email from the git hooks/post-receive script.
ebourg-guest pushed a commit to branch master
in repository maven-debian-helper.
commit 8c6ac35ec17e256ba3bfb94d821c5e45ce89f56d
Author: Emmanuel Bourg <ebourg at apache.org>
Date: Wed Feb 5 14:48:18 2014 +0100
Default value for the simple questions
---
bin/mh_make | 8 ++++----
.../java/org/debian/maven/packager/DependenciesSolver.java | 4 ++--
.../debian/maven/packager/interaction/SimpleQuestion.java | 12 ++++++++++++
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/bin/mh_make b/bin/mh_make
index 3d207b8..3b16ed9 100755
--- a/bin/mh_make
+++ b/bin/mh_make
@@ -82,8 +82,8 @@ if [ -z "$PACKAGE" ]; then
PACKAGE=$(echo "$PACKAGE" | sed 's|.*/||' )
fi
echo
- echo "Enter the name of the new Debian source package. If empty, it will defaults to $PACKAGE"
- read -p ">" USER_PACKAGE
+ echo "Enter the name of the new Debian source package.
+ read -p "[$PACKAGE] >" USER_PACKAGE
if [ -n "$USER_PACKAGE" ]; then
PACKAGE=$USER_PACKAGE
fi
@@ -97,8 +97,8 @@ if [ -z "$BIN_PACKAGE" ]; then
BIN_PACKAGE="lib${PACKAGE}-java"
fi
echo
- echo "Enter the name of the binary package. If empty, it will defaults to $BIN_PACKAGE"
- read -p ">" USER_PACKAGE
+ echo "Enter the name of the binary package."
+ read -p "[$BIN_PACKAGE] >" USER_PACKAGE
if [ -n "$USER_PACKAGE" ]; then
BIN_PACKAGE=$USER_PACKAGE
fi
diff --git a/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java b/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
index d0be45e..6d5ee3a 100644
--- a/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
+++ b/maven-packager-utils/src/main/java/org/debian/maven/packager/DependenciesSolver.java
@@ -330,8 +330,8 @@ public class DependenciesSolver {
knownProjectDependencies.add(pom.getThisPom());
if (interactive && packageVersion == null) {
- String question = "Enter the upstream version for the package. If you press <Enter> it will default to " + pom.getOriginalVersion();
- String v = new SimpleQuestion(question).ask();
+ String question = "Enter the upstream version for the package.";
+ String v = new SimpleQuestion(question, pom.getOriginalVersion()).ask();
if (v.isEmpty()) {
v = pom.getOriginalVersion();
}
diff --git a/maven-packager-utils/src/main/java/org/debian/maven/packager/interaction/SimpleQuestion.java b/maven-packager-utils/src/main/java/org/debian/maven/packager/interaction/SimpleQuestion.java
index 0ccaa30..7faddcc 100644
--- a/maven-packager-utils/src/main/java/org/debian/maven/packager/interaction/SimpleQuestion.java
+++ b/maven-packager-utils/src/main/java/org/debian/maven/packager/interaction/SimpleQuestion.java
@@ -23,13 +23,25 @@ package org.debian.maven.packager.interaction;
*/
public class SimpleQuestion extends Question<String> {
+ private String defaultValue;
+
public SimpleQuestion(String question) {
super(question);
}
+ public SimpleQuestion(String question, String defaultValue) {
+ super(question);
+ this.defaultValue = defaultValue;
+ }
+
@Override
public String ask() {
println(question);
+ if (defaultValue != null) {
+ print("[");
+ print(defaultValue);
+ print("] ");
+ }
print("> ");
return readLine();
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/maven-debian-helper.git
More information about the pkg-java-commits
mailing list