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

devonfw / IDEasy / 10162826108

30 Jul 2024 12:59PM UTC coverage: 61.738% (+0.07%) from 61.669%
10162826108

push

github

web-flow
#429: writing properties to conf (#454)

2047 of 3651 branches covered (56.07%)

Branch coverage included in aggregate %.

5443 of 8481 relevant lines covered (64.18%)

2.82 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/VersionSetCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import com.devonfw.tools.ide.context.IdeContext;
4
import com.devonfw.tools.ide.environment.EnvironmentVariablesFiles;
5
import com.devonfw.tools.ide.property.EnumProperty;
6
import com.devonfw.tools.ide.property.ToolProperty;
7
import com.devonfw.tools.ide.property.VersionProperty;
8
import com.devonfw.tools.ide.tool.ToolCommandlet;
9
import com.devonfw.tools.ide.version.VersionIdentifier;
10

11
/**
12
 * An internal {@link Commandlet} to set a tool version.
13
 *
14
 * @see ToolCommandlet#setVersion(VersionIdentifier, boolean)
15
 */
16
public class VersionSetCommandlet extends Commandlet {
17

18
  /** The tool to set the version of. */
19
  public final ToolProperty tool;
20

21
  /** The version to set. */
22
  public final VersionProperty version;
23

24
  public final EnumProperty<EnvironmentVariablesFiles> cfg;
25

26
  /**
27
   * The constructor.
28
   *
29
   * @param context the {@link IdeContext}.
30
   */
31
  public VersionSetCommandlet(IdeContext context) {
32

33
    super(context);
3✔
34
    addKeyword(getName());
4✔
35
    this.tool = add(new ToolProperty("", true, "tool"));
11✔
36
    this.version = add(new VersionProperty("", true, "version"));
11✔
37
    this.cfg = add(new EnumProperty("--cfg", false, null, EnvironmentVariablesFiles.class));
12✔
38
  }
1✔
39

40
  @Override
41
  public String getName() {
42

43
    return "set-version";
2✔
44
  }
45

46
  @Override
47
  public void run() {
48

49
    ToolCommandlet commandlet = this.tool.getValue();
5✔
50
    VersionIdentifier versionIdentifier = this.version.getValue();
5✔
51
    EnvironmentVariablesFiles env = this.cfg.getValue();
5✔
52
    commandlet.setVersion(versionIdentifier, true, env);
5✔
53
  }
1✔
54

55
  @Override
56
  public ToolCommandlet getToolForVersionCompletion() {
57

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

61
}
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