Skip to content

Commit 614db1b

Browse files
committed
fix(cli): model --share as boolean switch
1 parent db36a2f commit 614db1b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎src/main/java/io/github/easy4j/opencode/cli/OpenCodeRunOptions.java‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class OpenCodeRunOptions {
4040
private boolean continueLast;
4141
private String sessionId;
4242
private boolean fork;
43-
private String share;
43+
private boolean share;
4444
private String model;
4545
private String agent;
4646
private List<String> files;
@@ -76,7 +76,14 @@ public OpenCodeRunOptions(String message) {
7676
public OpenCodeRunOptions fork(boolean v) { this.fork = v; return this; }
7777

7878
/** Sets the {@code --share} flag — share the session after the run. */
79-
public OpenCodeRunOptions share(String v) { this.share = v; return this; }
79+
public OpenCodeRunOptions share(boolean v) { this.share = v; return this; }
80+
81+
/**
82+
* @deprecated OpenCode models {@code --share} as a boolean switch. Any non-null legacy
83+
* value enables the switch and the value itself is ignored.
84+
*/
85+
@Deprecated
86+
public OpenCodeRunOptions share(String v) { this.share = v != null; return this; }
8087

8188
/** Sets the {@code --model/-m} flag — provider/model identifier. */
8289
public OpenCodeRunOptions model(String v) { this.model = v; return this; }
@@ -130,7 +137,7 @@ public String[] toArgs() {
130137
if (continueLast) { args.add("--continue"); }
131138
if (sessionId != null) { args.add("--session"); args.add(sessionId); }
132139
if (fork) { args.add("--fork"); }
133-
if (share != null) { args.add("--share"); args.add(share); }
140+
if (share) { args.add("--share"); }
134141
if (model != null) { args.add("--model"); args.add(model); }
135142
if (agent != null) { args.add("--agent"); args.add(agent); }
136143
if (files != null) {

0 commit comments

Comments
 (0)