You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As described in this comment, we want to add a -o flag for smartly redirecting output in dagger call.
This flag would be applicable for any return type and result in that result being written to the caller's filesystem rather than written to stdout.
For simple cases like a string return type, this would have the same end effect as a shell redirection. The difference is that we would allow some special case handling for it too. So if myfunc returns a Directory, this would work:
dagger run -o ./some/output/dir myfunc
and result in the the directory returned by myfunc to be written to ./some/output/dir.
To start, -o would be exclusively for writing to the cli caller's filesystem.
I suppose you could in theory expand to other output destinations via a scheme:// type approach if we ever wanted to, but that's just a possible future extension point, not in scope now and just a random idea.
Also important to note that this would not inherently remove support for the full ... export --path ./some/output/dir style either, it would just be a supplement to it.
So, if you use --export and -o together, you'll be outputting the boolean that export returns, right? Supporting both can lead to confusion over which one to use but we're also considering changing export to return Void instead or even removing that field from Container/Directory into Host or something else I guess.
What's more expected? To write an empty file with -o on a void or return an error? I lean towards avoiding the error, but wanting to output a void is surely a mistake so I think it's better to warn (not error).
Activity
helderco commentedon Jan 3, 2024
So, if you use
--exportand-otogether, you'll be outputting the boolean thatexportreturns, right? Supporting both can lead to confusion over which one to use but we're also considering changing export to returnVoidinstead or even removing that field fromContainer/DirectoryintoHostor something else I guess.What's more expected? To write an empty file with
-oon a void or return an error? I lean towards avoiding the error, but wanting to output a void is surely a mistake so I think it's better to warn (not error).