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

devonfw / IDEasy / 24984011544

27 Apr 2026 08:14AM UTC coverage: 70.718% (+0.08%) from 70.641%
24984011544

Pull #1856

github

web-flow
Merge f59d7af1d into 344d6c0f7
Pull Request #1856: #1643 improve ux on syntax error

4403 of 6878 branches covered (64.02%)

Branch coverage included in aggregate %.

11348 of 15395 relevant lines covered (73.71%)

3.12 hits per line

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

92.59
cli/src/main/java/com/devonfw/tools/ide/property/ToolProperty.java
1
package com.devonfw.tools.ide.property;
2

3
import java.util.stream.Collectors;
4

5
import com.devonfw.tools.ide.commandlet.Commandlet;
6
import com.devonfw.tools.ide.completion.CompletionCandidateCollector;
7
import com.devonfw.tools.ide.context.IdeContext;
8
import com.devonfw.tools.ide.tool.ToolCommandlet;
9
import com.devonfw.tools.ide.validation.PropertyValidator;
10

11
/**
12
 * {@link Property} with {@link #getValueType() value type} {@link ToolCommandlet}.
13
 */
14
public class ToolProperty extends Property<ToolCommandlet> {
15

16
  /**
17
   * The constructor.
18
   *
19
   * @param name the {@link #getName() property name}.
20
   * @param required the {@link #isRequired() required flag}.
21
   * @param alias the {@link #getAlias() property alias}.
22
   */
23
  public ToolProperty(String name, boolean required, String alias) {
24

25
    this(name, required, alias, false, null);
7✔
26
  }
1✔
27

28
  /**
29
   * The constructor.
30
   *
31
   * @param name the {@link #getName() property name}.
32
   * @param required the {@link #isRequired() required flag}.
33
   * @param multivalued the boolean flag about multiple arguments
34
   * @param alias the {@link #getAlias() property alias}.
35
   */
36
  public ToolProperty(String name, boolean required, boolean multivalued, String alias) {
37

38
    this(name, required, alias, multivalued, null);
7✔
39
  }
1✔
40

41
  /**
42
   * The constructor.
43
   *
44
   * @param name the {@link #getName() property name}.
45
   * @param required the {@link #isRequired() required flag}.
46
   * @param alias the {@link #getAlias() property alias}.
47
   * @param multivalued the boolean flag about multiple arguments
48
   * @param validator the {@link PropertyValidator} used to {@link #validate() validate} the {@link #getValue() value}.
49
   */
50
  public ToolProperty(String name, boolean required, String alias, boolean multivalued, PropertyValidator<ToolCommandlet> validator) {
51

52
    super(name, required, alias, multivalued, validator);
7✔
53
  }
1✔
54

55
  @Override
56
  public Class<ToolCommandlet> getValueType() {
57

58
    return ToolCommandlet.class;
×
59
  }
60

61
  @Override
62
  protected String format(ToolCommandlet valueToFormat) {
63

64
    return valueToFormat.getName();
×
65
  }
66

67
  @Override
68
  public ToolCommandlet parse(String valueAsString, IdeContext context) {
69

70
    return context.getCommandletManager().getRequiredToolCommandlet(valueAsString);
5✔
71
  }
72

73
  @Override
74
  protected String getValidValuesErrorHint(IdeContext context, Commandlet commandlet) {
75

76
    return context.getCommandletManager().getCommandlets().stream()
6✔
77
        .filter(c -> c instanceof ToolCommandlet)
5✔
78
        .map(Commandlet::getName)
2✔
79
        .map(n -> "'" + n + "'")
5✔
80
        .collect(Collectors.joining(", "));
3✔
81
  }
82

83
  @Override
84
  protected void completeValue(String arg, IdeContext context, Commandlet commandlet, CompletionCandidateCollector collector) {
85

86
    for (Commandlet cmd : context.getCommandletManager().getCommandlets()) {
12✔
87
      if (cmd instanceof ToolCommandlet) {
3✔
88
        String cmdName = cmd.getName();
3✔
89
        if (cmdName.startsWith(arg)) {
4✔
90
          collector.add(cmdName, null, null, cmd);
6✔
91
        }
92
      }
93
    }
1✔
94
  }
1✔
95

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