Open
Conversation
4135fdd to
e25545f
Compare
Co-author: Chris Naples cnaples79@gmail.com (@cnaples79) - Fixes apple#360. - Adapts apple#730 to new dispatch mechanism. - Gets rid of wonky error message when `--debug` is placed after the subcommand and before `--`.
e25545f to
e4861f8
Compare
dcantah
reviewed
Jan 20, 2026
Comment on lines
-34
to
-38
| public func run() async throws { | ||
| var application = try Application.parse(arguments) | ||
| try application.validate() | ||
| try application.run() | ||
| } |
Member
There was a problem hiding this comment.
My brain is fried with all of the implicit main funcs being called and when validate actually runs for subcommands logic, but does this mean we don't run validate's logic for every command anymore now? This is where we were shoving in some "nice to run every time" logic:
public func validate() throws {
// Not really a "validation", but a cheat to run this before
// any of the commands do their business.
let debugEnvVar = ProcessInfo.processInfo.environment["CONTAINER_DEBUG"]
if self.global.debug || debugEnvVar != nil {
log.logLevel = .debug
}
// Ensure we're not running under Rosetta.
if try isTranslated() {
throw ValidationError(
"""
`container` is currently running under Rosetta Translation, which could be
caused by your terminal application. Please ensure this is turned off.
"""
)
}
}
3 tasks
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Co-author: Chris Naples cnaples79@gmail.com (@cnaples79)
--debugis placed after the subcommand and before--.Type of Change
Motivation and Context
That error message is really vexing.
Testing