Skip to content

Commit 95649c4

Browse files
authored
Merge pull request #27 from engalar/feat/tui-diff-view
feat(tui): interactive diff view with unified/side-by-side/plain modes
2 parents acb15e2 + 2085e9d commit 95649c4

41 files changed

Lines changed: 7118 additions & 655 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/mxcli/cmd_tui.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Example:
5959

6060
m := tui.NewApp(mxcliPath, projectPath)
6161
p := tea.NewProgram(m, tea.WithAltScreen(), tea.WithMouseCellMotion())
62+
m.StartWatcher(p)
6263
if _, err := p.Run(); err != nil {
6364
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
6465
os.Exit(1)

cmd/mxcli/docker/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func Build(opts BuildOptions) error {
9090
// Step 4: Pre-build check
9191
if !opts.SkipCheck {
9292
fmt.Fprintln(w, "Checking project for errors...")
93-
mxPath, err := resolveMx(opts.MxBuildPath)
93+
mxPath, err := ResolveMx(opts.MxBuildPath)
9494
if err != nil {
9595
fmt.Fprintf(w, " Skipping check: %v\n", err)
9696
} else {

cmd/mxcli/docker/check.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func Check(opts CheckOptions) error {
3939
}
4040

4141
// Resolve mx binary
42-
mxPath, err := resolveMx(opts.MxBuildPath)
42+
mxPath, err := ResolveMx(opts.MxBuildPath)
4343
if err != nil {
4444
return err
4545
}
@@ -67,9 +67,9 @@ func mxBinaryName() string {
6767
return "mx"
6868
}
6969

70-
// resolveMx finds the mx executable.
70+
// ResolveMx finds the mx executable.
7171
// Priority: derive from mxbuild path > PATH lookup.
72-
func resolveMx(mxbuildPath string) (string, error) {
72+
func ResolveMx(mxbuildPath string) (string, error) {
7373
if mxbuildPath != "" {
7474
// Resolve mxbuild first to handle directory paths
7575
resolvedMxBuild, err := resolveMxBuild(mxbuildPath)
@@ -102,5 +102,16 @@ func resolveMx(mxbuildPath string) (string, error) {
102102
return p, nil
103103
}
104104

105+
// Try cached mxbuild installations (~/.mxcli/mxbuild/*/modeler/mx).
106+
// NOTE: lexicographic sort is imperfect for versions (e.g. "9.x" > "10.x"),
107+
// but this is a fallback-of-last-resort — in practice users typically have
108+
// only one mxbuild version installed.
109+
if home, err := os.UserHomeDir(); err == nil {
110+
matches, _ := filepath.Glob(filepath.Join(home, ".mxcli", "mxbuild", "*", "modeler", mxBinaryName()))
111+
if len(matches) > 0 {
112+
return matches[len(matches)-1], nil
113+
}
114+
}
115+
105116
return "", fmt.Errorf("mx not found; specify --mxbuild-path pointing to Mendix installation directory")
106117
}

0 commit comments

Comments
 (0)