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

devonfw / IDEasy / 9904178931

12 Jul 2024 07:32AM UTC coverage: 61.387% (-0.5%) from 61.842%
9904178931

push

github

web-flow
#400: fix error handling for undefined IDE_ROOT and IDE_HOME (#476)

1997 of 3575 branches covered (55.86%)

Branch coverage included in aggregate %.

5297 of 8307 relevant lines covered (63.77%)

2.8 hits per line

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

74.07
cli/src/main/java/com/devonfw/tools/ide/commandlet/EnvironmentCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import com.devonfw.tools.ide.context.AbstractIdeContext;
4
import com.devonfw.tools.ide.context.IdeContext;
5
import com.devonfw.tools.ide.environment.VariableLine;
6
import com.devonfw.tools.ide.os.WindowsPathSyntax;
7
import com.devonfw.tools.ide.property.FlagProperty;
8

9
import java.util.Collection;
10

11
/**
12
 * {@link Commandlet} to print the environment variables.
13
 */
14
public final class EnvironmentCommandlet extends Commandlet {
15

16
  /** {@link FlagProperty} to enable Bash (MSys) path conversion on Windows. */
17
  public final FlagProperty bash;
18

19
  /**
20
   * The constructor.
21
   *
22
   * @param context the {@link IdeContext}.
23
   */
24
  public EnvironmentCommandlet(IdeContext context) {
25

26
    super(context);
3✔
27
    addKeyword(getName());
4✔
28
    this.bash = add(new FlagProperty("--bash", false, null));
11✔
29
  }
1✔
30

31
  @Override
32
  public String getName() {
33

34
    return "env";
2✔
35
  }
36

37
  @Override
38
  public boolean isIdeHomeRequired() {
39

40
    return true;
2✔
41
  }
42

43
  @Override
44
  public boolean isProcessableOutput() {
45
    
46
    return true;
×
47
  }
48

49
  @Override
50
  public void run() {
51

52
    WindowsPathSyntax pathSyntax = null;
2✔
53
    if (this.context.getSystemInfo().isWindows()) {
5!
54
      if (this.bash.isTrue()) {
×
55
        pathSyntax = WindowsPathSyntax.MSYS;
×
56
      } else {
57
        pathSyntax = WindowsPathSyntax.WINDOWS;
×
58
      }
59
    }
60
    ((AbstractIdeContext) this.context).setPathSyntax(pathSyntax);
5✔
61
    Collection<VariableLine> variables = this.context.getVariables().collectVariables();
5✔
62
    for (VariableLine line : variables) {
10✔
63
      String lineValue = line.getValue();
3✔
64
      lineValue = "\"" + lineValue + "\"";
3✔
65
      line = line.withValue(lineValue);
4✔
66
      this.context.info(line.toString());
5✔
67
    }
1✔
68
  }
1✔
69

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

© 2025 Coveralls, Inc