fix: change save path log to be relative
This commit is contained in:
+9
-1
@@ -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
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user