fix: change save path log to be relative

This commit is contained in:
2026-03-25 21:37:08 +00:00
parent 526e31d0b0
commit 6fae05eb6f
11 changed files with 59 additions and 33 deletions
+9 -1
View File
@@ -2,6 +2,7 @@ package cmd
import (
"errors"
"os"
"path/filepath"
"mire/internal/mire"
@@ -28,7 +29,14 @@ func newRecordCommand() *cobra.Command {
return err
}
output.Println(createdPath)
displayPath := createdPath
if cwd, err := os.Getwd(); err == nil {
if relPath, err := filepath.Rel(cwd, createdPath); err == nil {
displayPath = relPath
}
}
output.Printf("Saved at %s\n", displayPath)
return nil
},
}
+4 -4
View File
@@ -114,8 +114,8 @@ func TestRunRecord(t *testing.T) {
})
createdPath := filepath.Join(wantDir, "suite", "spec")
if !strings.Contains(stdout, createdPath) {
t.Fatalf("stdout = %q, want created path", stdout)
if !strings.Contains(stdout, prefixed("Saved at e2e/suite/spec\n")) {
t.Fatalf("stdout = %q, want saved message %q", stdout, prefixed("Saved at e2e/suite/spec\n"))
}
if !strings.Contains(stderr, "Save recording?") {
t.Fatalf("stderr = %q, want save prompt", stderr)
@@ -156,8 +156,8 @@ func TestRunRecordSaveFlagSkipsPrompt(t *testing.T) {
})
createdPath := filepath.Join(wantDir, "suite", "spec")
if !strings.Contains(stdout, createdPath) {
t.Fatalf("stdout = %q, want created path", stdout)
if !strings.Contains(stdout, prefixed("Saved at e2e/suite/spec\n")) {
t.Fatalf("stdout = %q, want saved message %q", stdout, prefixed("Saved at e2e/suite/spec\n"))
}
if strings.Contains(stderr, "Save recording?") {
t.Fatalf("stderr = %q, want save prompt omitted", stderr)