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

devonfw / IDEasy / 13547736881

26 Feb 2025 03:41PM UTC coverage: 68.227% (+0.2%) from 68.042%
13547736881

push

github

web-flow
#789: implement uninstall of IDEasy (#1071)

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

3029 of 4889 branches covered (61.96%)

Branch coverage included in aggregate %.

7860 of 11071 relevant lines covered (71.0%)

3.09 hits per line

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

89.66
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 boolean isIdeRootRequired() {
36

37
    return this.tools.getValueCount() > 0;
6!
38
  }
39

40
  @Override
41
  public void run() {
42

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

62
    }
63
  }
1✔
64
}
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