Skip to content

Commit

Permalink
chore(util): print commit id when calling scripts wich "--version" as…
Browse files Browse the repository at this point in the history
… it used to be (#1110)

Signed-off-by: Ning Yu <[email protected]>
  • Loading branch information
Chillax-0v0 authored Apr 11, 2024
1 parent 122cd78 commit cf4e29c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public static String getCommitId() {
return COMMIT_ID;
}

// AutoMQ inject start
public static String getVersionString() {
return String.format("%s (Commit:%s)", getVersion(), getCommitId());
}
// AutoMQ inject end

public static synchronized void registerAppInfo(String prefix, String id, Metrics metrics, long nowMs) {
try {
ObjectName name = new ObjectName(prefix + ":type=app-info,id=" + Sanitizer.jmxSanitize(id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ public static void printUsageAndExit(OptionParser parser, String message) {
}

public static void printVersionAndExit() {
System.out.println(AppInfoParser.getVersion());
// AutoMQ inject start
System.out.println(AppInfoParser.getVersionString());
// AutoMQ inject end
Exit.exit(0);
}

Expand Down

0 comments on commit cf4e29c

Please sign in to comment.