Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Sources/Services/ContainerAPIService/Client/Flags.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,43 @@ public struct Flags {
public var debug = false
}

/// Minimal subset of process-related options that intentionally does NOT
/// claim the common short flags (`-e`, `-u`, `-w`, `-i`, `-t`).
///
/// Downstream tools that wrap `container` (e.g. `compose run` /
/// `compose exec`) collide with `Flags.Process` because that struct
/// registers the short flags itself. Embedding ``ProcessBase`` instead
/// of ``Process`` lets the wrapping tool reclaim those short names for
/// its own subcommand-specific options while still inheriting the safe
/// long-form options (`--cwd`, `--env-file`).
///
/// Long-form behavior is identical to the matching fields in
/// ``Process`` so a caller can switch between them without touching the
/// rest of its `@OptionGroup` wiring.
public struct ProcessBase: ParsableArguments {
public init() {}

public init(cwd: String?, envFile: [String]) {
self.cwd = cwd
self.envFile = envFile
}

@Option(
name: .long,
help: .init(
"Set the initial working directory inside the container",
valueName: "dir"
)
)
public var cwd: String?

@Option(
name: .long,
help: "Read in a file of environment variables (key=value format, ignores # comments and blank lines)"
)
public var envFile: [String] = []
}

public struct Process: ParsableArguments {
public init() {}

Expand Down