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

devonfw / IDEasy / 30532321896

30 Jul 2026 09:50AM UTC coverage: 72.592% (-0.001%) from 72.593%
30532321896

Pull #2204

github

web-flow
Merge 3ede9fc31 into ec264ffca
Pull Request #2204: #2192-support-for-auto-completion-synonyms

5000 of 7617 branches covered (65.64%)

Branch coverage included in aggregate %.

12888 of 17025 relevant lines covered (75.7%)

3.21 hits per line

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

26.09
cli/src/main/java/com/devonfw/tools/ide/commandlet/CompleteCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import java.util.HashSet;
4
import java.util.List;
5
import java.util.Set;
6

7
import com.devonfw.tools.ide.cli.CliArguments;
8
import com.devonfw.tools.ide.completion.CompletionCandidate;
9
import com.devonfw.tools.ide.completion.CompletionCandidateCollector;
10
import com.devonfw.tools.ide.completion.CompletionCandidateCollectorDefault;
11
import com.devonfw.tools.ide.context.AbstractIdeContext;
12
import com.devonfw.tools.ide.context.IdeContext;
13
import com.devonfw.tools.ide.property.StringProperty;
14

15
/**
16
 * {@link Commandlet} for auto-completion.
17
 */
18
public final class CompleteCommandlet extends Commandlet {
19

20
  /** The name of the complete commandlet. */
21
  public static final String NAME = "complete";
22

23
  /** {@link StringProperty} with the current CLI arguments to complete. */
24
  public final StringProperty args;
25

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

33
    super(context);
3✔
34
    addKeyword(getName());
4✔
35
    this.args = add(new StringProperty("", false, true, "args"));
12✔
36
  }
1✔
37

38
  @Override
39
  public String getName() {
40

41
    return NAME;
2✔
42
  }
43

44
  @Override
45
  public boolean isIdeRootRequired() {
46

47
    return false;
2✔
48
  }
49

50
  @Override
51
  public boolean isProcessableOutput() {
52

53
    return true;
×
54
  }
55

56
  @Override
57
  protected void doRun() {
58
    String[] argsArray = this.args.asArray();
×
59
    CliArguments arguments = CliArguments.ofCompletion(argsArray);
×
60
    Set<String> alreadyProvided = new HashSet<>();
×
61
    for (int i = 0; i < argsArray.length - 1; i++) {
×
62
      alreadyProvided.add(argsArray[i]);
×
63
    }
64
    CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(this.context, alreadyProvided);
×
65
    List<CompletionCandidate> candidates = ((AbstractIdeContext) this.context).complete(arguments, collector, true);
×
66
    for (CompletionCandidate candidate : candidates) {
×
67
      System.out.print(candidate.text()); // checkstyle:ignore SystemOut - completion output must reach stdout even when logging is disabled
×
68
      System.out.print('\n'); // checkstyle:ignore SystemOut - raw newline (not println) avoids a CR char in bash completion on Windows
×
69
    }
×
70
  }
×
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc