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

devonfw / IDEasy / 26212118157

21 May 2026 07:31AM UTC coverage: 70.979%. Remained the same
26212118157

push

github

web-flow
#836: fix exit autocompletion (#1950)

4453 of 6934 branches covered (64.22%)

Branch coverage included in aggregate %.

11481 of 15515 relevant lines covered (74.0%)

3.13 hits per line

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

86.96
cli/src/main/java/com/devonfw/tools/ide/completion/IdeCompleter.java
1
package com.devonfw.tools.ide.completion;
2

3
import java.util.List;
4

5
import org.jline.reader.Candidate;
6
import org.jline.reader.Completer;
7
import org.jline.reader.LineReader;
8
import org.jline.reader.ParsedLine;
9

10
import com.devonfw.tools.ide.cli.CliArguments;
11
import com.devonfw.tools.ide.context.AbstractIdeContext;
12

13
/**
14
 * Implements the {@link Completer} for jline3 autocompletion. Inspired by picocli
15
 */
16
public class IdeCompleter implements Completer {
17

18
  private static final String EXIT_COMMAND = "exit";
19

20
  private final AbstractIdeContext context;
21

22
  /**
23
   * The constructor.
24
   *
25
   * @param context the {@link AbstractIdeContext}.
26
   */
27
  public IdeCompleter(AbstractIdeContext context) {
28

29
    super();
2✔
30
    this.context = context;
3✔
31
  }
1✔
32

33
  @Override
34
  public void complete(LineReader reader, ParsedLine commandLine, List<Candidate> candidates) {
35

36
    String currentWord = commandLine.word();
3✔
37
    int wordIndex = commandLine.wordIndex();
3✔
38

39
    if (wordIndex == 0 && !currentWord.isEmpty() && EXIT_COMMAND.startsWith(currentWord)) {
9!
40
      candidates.add(new Candidate(EXIT_COMMAND));
×
41
    }
42

43
    List<String> words = commandLine.words();
3✔
44
    CliArguments args = CliArguments.ofCompletion(words.toArray(String[]::new));
9✔
45
    List<CompletionCandidate> completion = this.context.complete(args, true);
6✔
46
    int i = 0;
2✔
47
    for (CompletionCandidate candidate : completion) {
10✔
48
      candidates.add(new Candidate(candidate.text(), candidate.text(), null, null, null, null, true, i++));
17✔
49
    }
1✔
50
  }
1✔
51

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