Skip to content

Commit

Permalink
Merge pull request #73 from suganyasuven/local-update
Browse files Browse the repository at this point in the history
Modify json content
  • Loading branch information
keizer619 authored Jan 25, 2021
2 parents 192f8b3 + 9aa96f1 commit a279132
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main/java/org/ballerinalang/command/cmd/ListCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,14 @@ private static void listDistributions(PrintStream outStream) {
version = parts[1];
}
if (version.equals(distribution.getVersion())) {
outStream.println(markVersion(currentBallerinaVersion, version)
+ " " + distribution.getName());
releases.add(version);
String versionName = distribution.getName();
String versionId = distribution.getVersion();
JSONObject versionInfo = new JSONObject();
versionInfo.put("name", versionName);
versionInfo.put("version", versionId);
outStream.println(markVersion(currentBallerinaVersion, versionId)
+ " " + versionName);
releases.add(versionInfo);
}
}
}
Expand Down Expand Up @@ -207,9 +212,10 @@ private static void readLocalDistsFromJson(PrintStream outStream, String current
for (Object channel: channels) {
JSONObject channelObj = (JSONObject) channel;
JSONArray releases = (JSONArray) channelObj.get("releases");
for (Object version : releases) {
outStream.println(markVersion(currentBallerinaVersion, version.toString()) + " " +
ToolUtil.getTypeName(version.toString()));
for (Object release : releases) {
JSONObject versionInfo = (JSONObject) release;
outStream.println(markVersion(currentBallerinaVersion, versionInfo.get("version").toString()) +
" " + versionInfo.get("name").toString());
}
}
} catch (IOException | ParseException e) {
Expand Down

0 comments on commit a279132

Please sign in to comment.