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

devonfw / IDEasy / 19679625723

25 Nov 2025 06:12PM UTC coverage: 69.147% (+0.02%) from 69.131%
19679625723

push

github

web-flow
#1608: Add git and bash location to status (#1609)

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

3643 of 5779 branches covered (63.04%)

Branch coverage included in aggregate %.

9461 of 13172 relevant lines covered (71.83%)

3.15 hits per line

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

71.0
cli/src/main/java/com/devonfw/tools/ide/commandlet/StatusCommandlet.java
1
package com.devonfw.tools.ide.commandlet;
2

3
import java.nio.file.Files;
4
import java.nio.file.Path;
5

6
import com.devonfw.tools.ide.context.IdeContext;
7
import com.devonfw.tools.ide.environment.EnvironmentVariables;
8
import com.devonfw.tools.ide.git.GitContext;
9
import com.devonfw.tools.ide.migration.IdeMigrator;
10
import com.devonfw.tools.ide.os.SystemInfo;
11
import com.devonfw.tools.ide.step.Step;
12
import com.devonfw.tools.ide.tool.IdeasyCommandlet;
13
import com.devonfw.tools.ide.version.VersionIdentifier;
14

15
/**
16
 * {@link Commandlet} to print a status report about IDEasy.
17
 */
18
public class StatusCommandlet extends Commandlet {
19

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

27
    super(context);
3✔
28
    addKeyword(getName());
4✔
29
  }
1✔
30

31
  @Override
32
  public String getName() {
33

34
    return "status";
2✔
35
  }
36

37
  @Override
38
  public void run() {
39
    Step step = this.context.newStep(true, "Show IDE_ROOT and IDE_HOME");
8✔
40
    step.run(this.context::logIdeHomeAndRootStatus);
9✔
41
    step = this.context.newStep(true, "Show online status");
8✔
42
    step.run(this::logOnlineStatus);
5✔
43
    step = this.context.newStep(true, "Show git and bash location");
8✔
44
    step.run(this::logGitBashLocationStatus);
5✔
45

46
    if (this.context.getIdeHome() != null) {
4✔
47
      step = this.context.newStep(true, "Show git status");
8✔
48
      step.run(this::logSettingsGitStatus);
5✔
49
      step = this.context.newStep(true, "Show legacy status");
8✔
50
      step.run(this::logSettingsLegacyStatus);
5✔
51
      step = this.context.newStep(true, "Show migration status");
8✔
52
      step.run(this::logMigrationStatus);
5✔
53
    }
54
    step = this.context.newStep(true, "Check for updates of IDEasy");
8✔
55
    step.run(this::checkForUpdate);
5✔
56
  }
1✔
57

58
  private void checkForUpdate() {
59
    new IdeasyCommandlet(this.context, null).checkIfUpdateIsAvailable();
8✔
60
    logSystemInfo();
2✔
61
  }
1✔
62

63
  private void logSystemInfo() {
64
    SystemInfo systemInfo = this.context.getSystemInfo();
4✔
65
    this.context.info("Your operating system is {}({})@{} [{}@{}]", systemInfo.getOs(), systemInfo.getOsVersion(), systemInfo.getArchitecture(),
24✔
66
        systemInfo.getOsName(), systemInfo.getArchitectureName());
7✔
67
  }
1✔
68

69
  private void logSettingsLegacyStatus() {
70
    EnvironmentVariables variables = this.context.getVariables();
4✔
71
    boolean hasLegacyProperties = false;
2✔
72
    while (variables != null) {
2✔
73
      Path legacyProperties = variables.getLegacyPropertiesFilePath();
3✔
74
      if (legacyProperties != null && Files.exists(legacyProperties)) {
7!
75
        hasLegacyProperties = true;
×
76
        this.context.warning("Found legacy properties {}", legacyProperties);
×
77
      }
78
      variables = variables.getParent();
3✔
79
    }
1✔
80
    if (hasLegacyProperties) {
2!
81
      this.context.warning(
×
82
          "Your settings are outdated and contain legacy configurations. Please consider upgrading your settings:\nhttps://github.com/devonfw/IDEasy/blob/main/documentation/settings.adoc#upgrade");
83
    }
84
  }
1✔
85

86
  private void logSettingsGitStatus() {
87
    Path settingsPath = this.context.getSettingsGitRepository();
4✔
88
    if (settingsPath == null) {
2!
89
      if (this.context.getIdeHome() != null) {
4!
90
        this.context.error("No settings repository was found.");
5✔
91
      }
92
    } else {
93
      GitContext gitContext = this.context.getGitContext();
×
94
      if (gitContext.isRepositoryUpdateAvailable(settingsPath, this.context.getSettingsCommitIdPath())) {
×
95
        if (!this.context.isSettingsRepositorySymlinkOrJunction()) {
×
96
          this.context.warning("Your settings are not up-to-date, please run 'ide update'.");
×
97
        }
98
      } else {
99
        this.context.success("Your settings are up-to-date.");
×
100
      }
101
      String branch = gitContext.determineCurrentBranch(settingsPath);
×
102
      this.context.debug("Your settings branch is {}", branch);
×
103
      if (!"master".equals(branch) && !"main".equals(branch)) {
×
104
        this.context.warning("Your settings are on a custom branch: {}", branch);
×
105
      }
106
    }
107
  }
1✔
108

109
  private void logOnlineStatus() {
110
    this.context.getNetworkStatus().logStatusMessage();
4✔
111
  }
1✔
112

113
  private void logMigrationStatus() {
114

115
    IdeMigrator migrator = new IdeMigrator();
4✔
116
    VersionIdentifier projectVersion = this.context.getProjectVersion();
4✔
117
    VersionIdentifier targetVersion = migrator.getTargetVersion();
3✔
118
    if (projectVersion.isLess(targetVersion)) {
4!
119
      this.context.interaction("Your project is on IDEasy version {} and needs an update to version {}!\nPlease run 'ide update' to migrate your project",
14✔
120
          projectVersion, targetVersion);
121
    }
122
  }
1✔
123

124
  private void logGitBashLocationStatus() {
125
    Path bashPath = this.context.findBash();
4✔
126
    if (bashPath != null) {
2!
127
      this.context.success("Found bash executable at: {}", bashPath);
11✔
128
    } else {
129
      this.context.error("No bash executable was found on your system!");
×
130
    }
131
    GitContext gitContext = this.context.getGitContext();
4✔
132
    Path gitPath = gitContext.findGit();
3✔
133
    if (gitPath != null) {
2!
134
      this.context.success("Found git executable at: {}", gitPath);
×
135
    } else {
136
      this.context.error("No git executable was found on your system!");
4✔
137
    }
138
  }
1✔
139

140
  @Override
141
  public boolean isIdeRootRequired() {
142

143
    return false;
2✔
144
  }
145
}
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