Skip to content

CLI: support for -o flag #6357

Closed
Closed

Description

@sipsma

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.

Activity

  1. added
    area/cli
    on Jan 3, 2024
  2. helderco commented on Jan 3, 2024

    @helderco
    Contributor

    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).

  3. self-assigned this
    on Jan 15, 2024
  4. removed
    area/cli
    on May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions