Skip to content

Conversation

@cmcgee1024
Copy link
Contributor

@cmcgee1024 cmcgee1024 commented Feb 2, 2025

See issue #36 for an additional example.

Create the missing run method that takes a Configuration and returns a CollectedResult
@cmcgee1024 cmcgee1024 marked this pull request as ready for review February 21, 2025 16:17
@iCharlesHu
Copy link
Owner

Could you elaborate more on what's the benefit of this approach over declaring static vars on Configuration? For example:

extension Configuration {
    static var ls: Self {
        return Configuration(
            executable: .path("/bin/ls"),
            ...
        )
    }
}

The run() methods that take a Configuration was designed specifically for the use case above (I just realized I forgot to include a collected result version of the overload which I'll add).

let result = try await run(.ls)

@cmcgee1024
Copy link
Contributor Author

cmcgee1024 commented Mar 10, 2025

let result = try await run(.ls)

I'm not seeing how this var can build a command-line with the arguments provided at the call-site. How do I provide a specific directory "foo" with this approach and specify the long option?

With an Ls struct that conforms to the CommandBuilder protocol then I can do it like this:

let result = try await run(
    Ls(.long, paths: "foo")
)

@cmcgee1024 cmcgee1024 requested a review from iCharlesHu as a code owner March 21, 2025 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants