From a733b0fdfad7e5d59e8ba77e5f6fda4844df1b5c Mon Sep 17 00:00:00 2001 From: Jahir Vidrio Date: Sun, 5 Jul 2026 20:10:54 -0600 Subject: [PATCH] fix(compose): accept --project-directory pre-subcommand --- Sources/Mocker/ComposeArgNormalizer.swift | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Sources/Mocker/ComposeArgNormalizer.swift b/Sources/Mocker/ComposeArgNormalizer.swift index 0cda7b0..bf3b1eb 100644 --- a/Sources/Mocker/ComposeArgNormalizer.swift +++ b/Sources/Mocker/ComposeArgNormalizer.swift @@ -5,14 +5,19 @@ import Foundation /// are relocated to AFTER the subcommand token, where swift-argument-parser's /// per-subcommand `@OptionGroup` can actually parse them. /// -/// Only the compose-level global options `-f`/`--file` and `-p`/`--project-name` -/// are relocated; everything else is left exactly where it is so the parser's -/// normal validation and error messages are preserved. This is a pure function -/// so it can be unit-tested without spawning the CLI. +/// Only the compose-level global options `-f`/`--file`, `-p`/`--project-name`, +/// and `--project-directory` are relocated; everything else is +/// left exactly where it is so the parser's normal validation and error +/// messages are preserved. This is a pure function so it can be unit-tested +/// without spawning the CLI. enum ComposeArgNormalizer { /// Flags that take a separate value token and may legitimately appear before /// the compose subcommand (Docker places them there). - private static let valueFlags: Set = ["-f", "--file", "-p", "--project-name"] + private static let valueFlags: Set = [ + "-f", "--file", + "-p", "--project-name", + "--project-directory", + ] static func reorder(_ args: [String]) -> [String] { guard args.first == "compose" else { return args }