• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 15217656699

23 May 2025 07:22PM UTC coverage: 67.562% (-0.3%) from 67.89%
15217656699

push

github

web-flow
#1332: fixed bug pattern, proper Step usage, allow running tool if plugin failed (#1334)

Co-authored-by: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com>

3151 of 5064 branches covered (62.22%)

Branch coverage included in aggregate %.

8048 of 11512 relevant lines covered (69.91%)

3.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

82.35
cli/src/main/java/com/devonfw/tools/ide/commandlet/InstallPluginCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import com.devonfw.tools.ide.context.IdeContext;
4
import com.devonfw.tools.ide.property.PluginProperty;
5
import com.devonfw.tools.ide.property.ToolProperty;
6
import com.devonfw.tools.ide.step.Step;
7
import com.devonfw.tools.ide.tool.ToolCommandlet;
8
import com.devonfw.tools.ide.tool.plugin.PluginBasedCommandlet;
9

10
/**
11
 * {@link Commandlet} to install a tool.
12
 *
13
 * @see ToolCommandlet#install()
14
 */
15
public class InstallPluginCommandlet extends Commandlet {
16

17
  /** The tool to install. */
18
  public final ToolProperty tool;
19

20
  /** The optional version to set and install. */
21
  public final PluginProperty plugin;
22

23
  /**
24
   * The constructor.
25
   *
26
   * @param context the {@link IdeContext}.
27
   */
28
  public InstallPluginCommandlet(IdeContext context) {
29

30
    super(context);
3✔
31
    addKeyword(getName());
4✔
32
    this.tool = add(new ToolProperty("", true, "tool"));
11✔
33
    this.plugin = add(new PluginProperty("", true, "plugin"));
11✔
34
  }
1✔
35

36
  @Override
37
  public String getName() {
38

39
    return "install-plugin";
2✔
40
  }
41

42
  @Override
43
  public void run() {
44
    ToolCommandlet commandlet = this.tool.getValue();
5✔
45
    String plugin = this.plugin.getValue();
5✔
46

47
    if (commandlet instanceof PluginBasedCommandlet cmd) {
6!
48
      Step step = context.newStep("Install plugin: " + plugin);
6✔
49
      step.run(() -> cmd.installPlugin(cmd.getPlugin(plugin), step));
14✔
50
    } else {
1✔
51
      context.warning("Tool {} does not support installation of plugins.", commandlet.getName());
×
52
    }
53

54
  }
1✔
55

56
  @Override
57
  public ToolCommandlet getToolForCompletion() {
58

59
    return this.tool.getValue();
×
60
  }
61

62
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc