File tree Expand file tree Collapse file tree
src/main/java/io/github/easy4j/opencode/cli Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package io .github .easy4j .opencode .cli ;
2+
3+ import lombok .Data ;
4+
5+ import java .util .LinkedHashMap ;
6+ import java .util .Map ;
7+
8+ /**
9+ * Overrides that apply to one CLI child-process execution only.
10+ *
11+ * @author <a href="https://github.com/loong10k">Loong Wan</a>
12+ * @since 3.0.0
13+ */
14+ @ Data
15+ public class OpenCodeCliExecutionContext {
16+
17+ /** Whether the child starts from the parent JVM environment. */
18+ private boolean inheritParentEnvironment = true ;
19+
20+ /** Per-execution environment overrides. */
21+ private final Map <String , String > environment = new LinkedHashMap <>();
22+
23+ /** Optional per-execution working directory override. */
24+ private String workingDirectory ;
25+
26+ public OpenCodeCliExecutionContext environment (String name , String value ) {
27+ if (value == null ) {
28+ environment .remove (name );
29+ } else {
30+ environment .put (name , value );
31+ }
32+ return this ;
33+ }
34+
35+ public OpenCodeCliExecutionContext inheritParentEnvironment (boolean value ) {
36+ this .inheritParentEnvironment = value ;
37+ return this ;
38+ }
39+
40+ public OpenCodeCliExecutionContext workingDirectory (String value ) {
41+ this .workingDirectory = value ;
42+ return this ;
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments