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

devonfw / IDEasy / 13518757257

25 Feb 2025 10:12AM UTC coverage: 68.203% (+0.2%) from 68.046%
13518757257

Pull #1071

github

web-flow
Merge 424a5bd57 into cbacec943
Pull Request #1071: #789: implement uninstall of IDEasy

3025 of 4885 branches covered (61.92%)

Branch coverage included in aggregate %.

7854 of 11066 relevant lines covered (70.97%)

3.08 hits per line

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

92.31
cli/src/main/java/com/devonfw/tools/ide/commandlet/UninstallCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import com.devonfw.tools.ide.context.IdeContext;
4
import com.devonfw.tools.ide.property.ToolProperty;
5
import com.devonfw.tools.ide.tool.IdeasyCommandlet;
6
import com.devonfw.tools.ide.tool.ToolCommandlet;
7

8
/**
9
 * An internal {@link Commandlet} to uninstall a tool.
10
 */
11
public class UninstallCommandlet extends Commandlet {
12

13
  /** The tool to uninstall. */
14
  public final ToolProperty tools;
15

16
  /**
17
   * The constructor.
18
   *
19
   * @param context the {@link IdeContext}.
20
   */
21
  public UninstallCommandlet(IdeContext context) {
22

23
    super(context);
3✔
24
    addKeyword(getName());
4✔
25
    this.tools = add(new ToolProperty("", false, true, "tool"));
12✔
26
  }
1✔
27

28
  @Override
29
  public String getName() {
30

31
    return "uninstall";
2✔
32
  }
33

34
  @Override
35
  public void run() {
36

37
    int valueCount = this.tools.getValueCount();
4✔
38
    if (valueCount == 0) {
2✔
39
      if (!this.context.isForceMode()) {
4!
40
        this.context.askToContinue("Sub-command uninstall without any further arguments will perform the entire uninstallation of IDEasy.\n"
×
41
            + "Since this is typically not to be called manually, you may have forgotten to specify the tool to install as extra argument.\n"
42
            + "The current command will uninstall IDEasy from your computer. Are you sure?");
43
      }
44
      IdeasyCommandlet ideasy = new IdeasyCommandlet(this.context);
6✔
45
      ideasy.uninstallIdeasy();
2✔
46
      return;
1✔
47
    }
48
    for (int i = 0; i < valueCount; i++) {
7✔
49
      ToolCommandlet toolCommandlet = this.tools.getValue(i);
6✔
50
      if (toolCommandlet.getInstalledVersion() != null) {
3✔
51
        toolCommandlet.uninstall();
3✔
52
      } else {
53
        this.context.warning("Couldn't uninstall " + toolCommandlet.getName() + " because we could not find an installation");
6✔
54
      }
55

56
    }
57
  }
1✔
58
}
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