Skip to content

Commit 5092ad2

Browse files
committed
fix: exception when user refuses to install jbang
1 parent 48854c9 commit 5092ad2

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,23 @@ public int run(String... args) throws Exception {
9696
try {
9797
Optional<String> missing = checkMissingCommand(cmd, args);
9898
missing.ifPresent(m -> {
99-
Map<String, Plugin> installable = pluginManager.getInstallablePlugins();
100-
if (installable.containsKey(m)) {
101-
Plugin candidate = installable.get(m);
102-
PluginListItem item = new PluginListItem(false, candidate);
103-
PluginListTable table = new PluginListTable(List.of(item));
104-
output.info("Command %s not installed but the following plugin is available:\n%s", m, table.getContent());
105-
if (interactiveMode && Prompt.yesOrNo(true,
106-
"Would you like to install it now ?",
107-
args)) {
108-
pluginManager.addPlugin(m).ifPresent(added -> plugins.put(added.getName(), added));
109-
pluginCommandFactory.populateCommands(cmd, plugins);
99+
try {
100+
Map<String, Plugin> installable = pluginManager.getInstallablePlugins();
101+
if (installable.containsKey(m)) {
102+
Plugin candidate = installable.get(m);
103+
PluginListItem item = new PluginListItem(false, candidate);
104+
PluginListTable table = new PluginListTable(List.of(item));
105+
output.info("Command %s not installed but the following plugin is available:\n%s", m,
106+
table.getContent());
107+
if (interactiveMode && Prompt.yesOrNo(true,
108+
"Would you like to install it now ?",
109+
args)) {
110+
pluginManager.addPlugin(m).ifPresent(added -> plugins.put(added.getName(), added));
111+
pluginCommandFactory.populateCommands(cmd, plugins);
112+
}
110113
}
114+
} catch (Exception e) {
115+
output.error("Command %s is missing and can't be installed.", m);
111116
}
112117
});
113118
} catch (MutuallyExclusiveArgsException e) {

0 commit comments

Comments
 (0)