Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add a command-line interface to the WML diff functionality #3721
The diff functionality is there, so I figured it could be useful to expose it.
I would've just pushed straight to master instead of making a pull request, but I noticed output redirection doesn't seem to be working, so I decided to see if anyone had any idea why.
To be precise, the following command:
outputs the diff to the console and not to diff.cfg. I tried both in VSCode's integrated terminal and in a standard Windows command prompt. I imagine it'll probably work as expected on Linux, but I'd like it to work on Windows too.
So, shadowm tells me that the output redirection issue is something that's unavoidable on Windows due to the way Wesnoth sets up its console redirection (unless we were to offer a separate Wesnoth executable for command-line use, maybe). Thus, I'm going to have to rethink this implementation, as the output file will need to be passed to Wesnoth rather than making use of shell redirection if this is to be useable on Windows.
I could either:
As for a use-case... I think there could be a use-case but I've been unable to come up with a concrete example. This functionality is used in the engine, but for typical WML files a text-based diff is probably more useful than this structural diff.
Maybe this could be useful for comparing different unit type definitions? A text-based diff would be sensitive to the order of keys, but if I understand correctly, the structural diff would not be. I would need to enable preprocessing in the diff function for that to be possible though...