cmd/cue/cme: fix import error message regression

Change-Id: I665f67cfd5936399da33065ecedcd645d95ff1a8
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/5222
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cmd/cue/cmd/common.go b/cmd/cue/cmd/common.go
index 7ee0f4a..a423b99 100644
--- a/cmd/cue/cmd/common.go
+++ b/cmd/cue/cmd/common.go
@@ -18,6 +18,7 @@
 	"bytes"
 	"io"
 	"os"
+	"path/filepath"
 	"strings"
 	"testing"
 
@@ -311,3 +312,14 @@
 	inst := cue.Merge(insts...).Build(ti)
 	return inst, inst.Err
 }
+
+func shortFile(root string, f *build.File) string {
+	dir, _ := filepath.Rel(root, f.Filename)
+	if dir == "" {
+		return f.Filename
+	}
+	if !filepath.IsAbs(dir) {
+		dir = "." + string(filepath.Separator) + dir
+	}
+	return dir
+}
diff --git a/cmd/cue/cmd/orphans.go b/cmd/cue/cmd/orphans.go
index a168c7d..dd31d9d 100644
--- a/cmd/cue/cmd/orphans.go
+++ b/cmd/cue/cmd/orphans.go
@@ -96,10 +96,10 @@
 			}
 			continue
 		}
-		if len(objs) > 1 && len(path) == 0 && useList {
+		if len(objs) > 1 && len(path) == 0 && !useList {
 			return false, fmt.Errorf(
 				"%s, %s, or %s flag needed to handle multiple objects in file %s",
-				flagPath, flagList, flagFiles, f.Filename)
+				flagPath, flagList, flagFiles, shortFile(i.Root, f))
 		}
 
 		f, err := placeOrphans(b.cmd, d.Filename(), pkg, objs...)