-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
84 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 14 additions & 3 deletions
17
cli/src/main/java/com/devonfw/tools/ide/process/EnvironmentContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,30 @@ | ||
package com.devonfw.tools.ide.process; | ||
|
||
import java.nio.file.Path; | ||
|
||
/** | ||
* Interface for the environment context relatable in the case a tool needs to be run with an environment variable. | ||
*/ | ||
public interface EnvironmentContext { | ||
|
||
/** | ||
* Sets or overrides the specified environment variable only for the planned process execution. Please note that the environment variables are initialized | ||
* when the {@link EnvironmentContext} is created. This method explicitly set an additional or overrides an existing environment and will have effect for each | ||
* process execution invoked from this {@link EnvironmentContext} instance. | ||
* Sets or overrides the specified environment variable only in this context. Please note that the environment variables are initialized when the | ||
* {@link EnvironmentContext} is created. This method explicitly set an additional or overrides an existing environment and will have effect only within this | ||
* context and not change the {@link com.devonfw.tools.ide.environment.EnvironmentVariables} or {@link com.devonfw.tools.ide.common.SystemPath}. | ||
* | ||
* @param key the name of the environment variable (E.g. "PATH"). | ||
* @param value the value of the environment variable. | ||
* @return this {@link EnvironmentContext} for fluent API calls. | ||
*/ | ||
EnvironmentContext withEnvVar(String key, String value); | ||
|
||
/** | ||
* Extends the "PATH" variable with the given {@link Path} entry. The new entry will be added to the beginning of the "PATH" and potentially override other | ||
* entries if it contains the same binary. | ||
* | ||
* @param path the {@link Path} pointing to the folder with the binaries to add to the "PATH" variable. | ||
* @return this {@link EnvironmentContext} for fluent API calls. | ||
*/ | ||
EnvironmentContext withPathEntry(Path path); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters