~lattis/muon

add helpful error message when -Dopt=val is used after the builddir v1 APPLIED

Eli Schwartz: 1
 add helpful error message when -Dopt=val is used after the builddir

 1 files changed, 4 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~lattis/muon/patches/25433/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] add helpful error message when -Dopt=val is used after the builddir Export this patch

This violates the POSIX Utility Syntax Guidelines and muon does not
support it. But meson *does* support GNU-style argument permutation, so
people (read: me) may forget themselves and try it anyway.

When that happens, the current behavior is to simply drop the extra
operands on the floor, silently. Elevate this to an error, and throw in
a helpful bit of advice.
---
 src/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/main.c b/src/main.c
index bfaf40a..71a844c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -301,6 +301,10 @@ cmd_setup(uint32_t argc, uint32_t argi, char *const argv[])
		LOG_E("missing build dir");
		return false;
	}
	if (argc - argi > 1) {
		LOG_E("too many operands (did you try passing options after operands?)");
		return false;
	}

	const char *build = argv[argi];
	++argi;
-- 
2.33.0
I really like this change, but I wish it worked for all the cases, not
just the setup subcommand.  That would be kind of annoying to implement
though, so I think this is fine for now.  Maybe I will take a crack at
it!
Done!  I added your message to all subcommands, and consolidated some
other checks too.