fix: clarify session adopt yes flag · Entire
fix: clarify session adopt yes flag
04464a2→main·
peyton-alt·2w ago·2 files·+27 added/-1 removed
Sessions
0ed46044b4c8View transcript
[?
Session Adoption and Worktree Management FixesCodex·1 step](/content/gh/entireio/cli/session/019ef09e-1621-7183-8205-646a383a2faf#timeline-0ed46044b4c8/index.html)
Changes
2
cmd/entire/cli
Msession_adopt.go+1/-1
- Msession_adopt_test.go+26
59 unmodified lines
60
61
62
63
63
64
65
66
59 unmodified lines
cmd.Flags().StringVar(&opts.FromWorktree, "from", "", "source worktree that already tracks the session")
cmd.Flags().BoolVar(&opts.Force, "force", false, "replace an existing local state file for the same session")
cmd.Flags().BoolVar(&opts.Force, "yes", false, "replace an existing local state file for the same session")
cmd.Flags().BoolVar(&opts.Force, "yes", false, "confirm same-store adoption and replacement without prompting")
return cmd
}
Mcmd/entire/cli/session_adopt.go+1/-1
21 unmodified lines
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
21 unmodified lines
"github.com/entireio/cli/cmd/entire/cli/testutil"
)
func TestSessionAdopt_HelpDistinguishesForceAndYes(t *testing.T) {
cmd := newAdoptCmd()
var stdout bytes.Buffer
cmd.SetOut(&stdout)
cmd.SetArgs([]string{"--help"})
if err := cmd.ExecuteContext(context.Background()); err != nil {
t.Fatalf("expected help to render without error, got: %%v", err)
}
out := stdout.String()
for _, want := range []string{
"--force",
"replace an existing local state file for the same session",
"--yes",
"confirm same-store adoption and replacement without prompting",
} {
if !strings.Contains(out, want) {
t.Fatalf("help missing %%q:\n%%s", want, out)
}
}
if strings.Count(out, "replace an existing local state file for the same session") != 1 {
t.Fatalf("--force and --yes should not share replacement help text:\n%%s", out)
}
}
func TestSessionAdopt_CopiesExternalSessionIntoCurrentWorktree(t *testing.T) {
sourceRepo := setupAdoptRepo(t)
targetRepo := setupAdoptRepo(t)