aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.pgm
diff options
context:
space:
mode:
authorRobin Stocker <robin@nibor.org>2013-10-10 07:53:57 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-10-10 07:53:57 -0400
commitec56d0d82ace83584057000a22c81492cbb16d29 (patch)
tree224404872c326962e9461ff671c90daf25c79f8c /org.eclipse.jgit.pgm
parent4d2378f41b49bde32c7d3b50a8126407a057659b (diff)
parent2c969ea00b7267c266d0e9a6bc883c1d9ec645f1 (diff)
downloadjgit-ec56d0d82ace83584057000a22c81492cbb16d29.tar.gz
jgit-ec56d0d82ace83584057000a22c81492cbb16d29.zip
Merge "Add support for --version in JGit CLI"
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r--org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties1
-rw-r--r--org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java10
2 files changed, 10 insertions, 1 deletions
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
index bda8f781e0..5154e08c1a 100644
--- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
+++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties
@@ -258,6 +258,7 @@ usage_displayAListOfAllRegisteredJgitCommands=Display a list of all registered j
usage_displayAllPossibleMergeBases=display all possible merge bases
usage_displayThejavaStackTraceOnExceptions=display the Java stack trace on exceptions
usage_displayThisHelpText=display this help text
+usage_displayVersion=display jgit version
usage_dstPrefix=show the destination prefix instead of "b/"
usage_enableTheServiceInAllRepositories=enable the service in all repositories
usage_exportRepositoriesOverGit=Export repositories over git://
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
index b948bc2ebb..3648ffd8e4 100644
--- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
+++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Main.java
@@ -73,6 +73,9 @@ public class Main {
@Option(name = "--help", usage = "usage_displayThisHelpText", aliases = { "-h" })
private boolean help;
+ @Option(name = "--version", usage = "usage_displayVersion")
+ private boolean version;
+
@Option(name = "--show-stack-trace", usage = "usage_displayThejavaStackTraceOnExceptions")
private boolean showStackTrace;
@@ -167,7 +170,7 @@ public class Main {
try {
clp.parseArgument(argv);
} catch (CmdLineException err) {
- if (argv.length > 0 && !help) {
+ if (argv.length > 0 && !help && !version) {
writer.println(MessageFormat.format(CLIText.get().fatalError, err.getMessage()));
writer.flush();
System.exit(1);
@@ -204,6 +207,11 @@ public class Main {
System.exit(1);
}
+ if (version) {
+ String cmdId = Version.class.getSimpleName().toLowerCase();
+ subcommand = CommandCatalog.get(cmdId).create();
+ }
+
final TextBuiltin cmd = subcommand;
if (cmd.requiresRepository())
cmd.init(openGitDir(gitdir), null);