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

devonfw / IDEasy / 14313798819

07 Apr 2025 03:55PM UTC coverage: 67.315% (-0.1%) from 67.432%
14313798819

push

github

web-flow
#1007: Implemented granular force options for update command (#1180)

Co-authored-by: jan-vcapgemini <59438728+jan-vcapgemini@users.noreply.github.com>
Co-authored-by: Jörg Hohwiller <hohwille@users.noreply.github.com>

3066 of 4964 branches covered (61.76%)

Branch coverage included in aggregate %.

7901 of 11328 relevant lines covered (69.75%)

3.05 hits per line

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

0.0
cli/src/main/java/com/devonfw/tools/ide/context/IdeContextConsole.java
1
package com.devonfw.tools.ide.context;
2

3
import java.util.Scanner;
4

5
import com.devonfw.tools.ide.io.IdeProgressBar;
6
import com.devonfw.tools.ide.io.IdeProgressBarConsole;
7
import com.devonfw.tools.ide.log.IdeLogLevel;
8
import com.devonfw.tools.ide.log.IdeSubLoggerOut;
9

10
/**
11
 * Default implementation of {@link IdeContext} using the console.
12
 */
13
public class IdeContextConsole extends AbstractIdeContext {
14

15
  private final Scanner scanner;
16

17
  private boolean forcePull;
18

19
  private boolean forcePlugins;
20

21
  private boolean forceRepositories;
22

23
  /**
24
   * The constructor.
25
   *
26
   * @param minLogLevel the minimum {@link IdeLogLevel} to enable. Should be {@link IdeLogLevel#INFO} by default.
27
   * @param out the {@link Appendable} to {@link Appendable#append(CharSequence) write} log messages to.
28
   * @param colored - {@code true} for colored output according to {@link IdeLogLevel}, {@code false} otherwise.
29
   */
30
  public IdeContextConsole(IdeLogLevel minLogLevel, Appendable out, boolean colored) {
31

32
    super(new IdeStartContextImpl(minLogLevel, level -> new IdeSubLoggerOut(level, out, colored, minLogLevel, null)), null);
×
33
    if (System.console() == null) {
×
34
      debug("System console not available - using System.in as fallback");
×
35
      this.scanner = new Scanner(System.in);
×
36
    } else {
37
      this.scanner = null;
×
38
    }
39
  }
×
40

41
  /**
42
   * The constructor.
43
   *
44
   * @param startContext the {@link IdeStartContextImpl}.
45
   */
46
  public IdeContextConsole(IdeStartContextImpl startContext) {
47

48
    super(startContext, null);
×
49
    if (System.console() == null) {
×
50
      debug("System console not available - using System.in as fallback");
×
51
      this.scanner = new Scanner(System.in);
×
52
    } else {
53
      this.scanner = null;
×
54
    }
55
  }
×
56

57
  @Override
58
  protected String readLine() {
59

60
    if (this.scanner == null) {
×
61
      return System.console().readLine();
×
62
    } else {
63
      return this.scanner.nextLine();
×
64
    }
65
  }
66

67
  @Override
68
  public IdeProgressBar newProgressBar(String title, long size, String unitName, long unitSize) {
69

70
    return new IdeProgressBarConsole(getSystemInfo(), title, size, unitName, unitSize);
×
71
  }
72

73
  @Override
74
  public boolean isForcePull() {
75
    return forcePull;
×
76
  }
77

78
  @Override
79
  public boolean isForcePlugins() {
80
    return forcePlugins;
×
81
  }
82

83
  @Override
84
  public boolean isForceRepositories() {
85
    return forceRepositories;
×
86
  }
87

88
  @Override
89
  public void setForcePull(boolean forcePull) {
90
    this.forcePull = forcePull;
×
91
  }
×
92

93
  @Override
94
  public void setForcePlugins(boolean forcePlugins) {
95
    this.forcePlugins = forcePlugins;
×
96
  }
×
97

98
  @Override
99
  public void setForceRepositories(boolean forceRepositories) {
100
    this.forceRepositories = forceRepositories;
×
101
  }
×
102
}
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