Skip to content

Commit

Permalink
fix(cli): concat new lines in plugin description
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Jan 20, 2025
1 parent ea59164 commit bc4bb0d
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions jadx-cli/src/main/java/jadx/cli/commands/CommandPlugins.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private static void printPlugins(List<JadxPluginMetadata> installed) {
sb.append(" (disabled)");
}
sb.append(" - ").append(plugin.getName());
sb.append(": ").append(plugin.getDescription());
sb.append(": ").append(formatDescription(plugin.getDescription()));
System.out.println(sb);
}
}
Expand Down Expand Up @@ -192,11 +192,24 @@ private static void printAllPlugins() {
if (!installedSet.contains(plugin.getPluginId())) {
System.out.println(" - " + plugin.getPluginId()
+ " - " + plugin.getName()
+ ": " + plugin.getDescription());
+ ": " + formatDescription(plugin.getDescription()));
}
}
}

private static String formatDescription(String desc) {
if (desc.contains("\n")) {
// remove new lines
desc = desc.replaceAll("\\R+", " ");
}
int maxLen = 512;
if (desc.length() > maxLen) {
// truncate very long descriptions
desc = desc.substring(0, maxLen) + " ...";
}
return desc;
}

private void installPlugin(String locationId) {
JadxPluginMetadata plugin = JadxPluginsTools.getInstance().install(locationId);
System.out.println("Plugin installed: " + plugin.getPluginId() + ":" + plugin.getVersion());
Expand Down

0 comments on commit bc4bb0d

Please sign in to comment.