diff --git a/src/nimblepkg/options.nim b/src/nimblepkg/options.nim index 28560e7..72f4a3a 100644 --- a/src/nimblepkg/options.nim +++ b/src/nimblepkg/options.nim @@ -390,9 +390,18 @@ proc parseMisc(options: var Options) = proc handleUnknownFlags(options: var Options) = if options.action.typ == actionRun: + # ActionRun uses flags that come before the command as compilation flags + # and flags that come after as run flags. options.action.compileFlags = map(options.unknownFlags, x => getFlagString(x[0], x[1], x[2])) options.unknownFlags = @[] + else: + # For everything else, handle the flags that came before the command + # normally. + let unknownFlags = options.unknownFlags + options.unknownFlags = @[] + for flag in unknownFlags: + parseFlag(flag[1], flag[2], options, flag[0]) # Any unhandled flags? if options.unknownFlags.len > 0: diff --git a/tests/tester.nim b/tests/tester.nim index 21c7011..efa0107 100644 --- a/tests/tester.nim +++ b/tests/tester.nim @@ -79,6 +79,13 @@ proc hasLineStartingWith(lines: seq[string], prefix: string): bool = return true return false +test "depsOnly + flag order test": + var (output, exitCode) = execNimble( + "--depsOnly", "install", "-y", "https://github.com/nimble-test/packagebin2" + ) + check(not output.contains("Success: packagebin2 installed successfully.")) + check exitCode == QuitSuccess + test "caching of nims and ini detects changes": cd "caching": var (output, exitCode) = execNimble("dump")